Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unnessesarry checks causing port access conflicts. #196

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions itrace_core/GazePointTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace iTrace_Core
{
class GazePointTracker : ITracker
{
private readonly String GAZEPOINT_ADDRESS = "127.0.0.1";
private readonly String GAZEPOINT_ADDRESS = "192.168.77.161";
private readonly int GAZEPOINT_PORT = 4242;
private System.Net.Sockets.TcpClient Client;
private System.IO.StreamReader Reader;
Expand All @@ -32,12 +32,12 @@ public GazePointTracker()
try
{
Client = new System.Net.Sockets.TcpClient();
IAsyncResult conn = Client.BeginConnect(GAZEPOINT_ADDRESS, GAZEPOINT_PORT, null, null);
//IAsyncResult conn = Client.BeginConnect(GAZEPOINT_ADDRESS, GAZEPOINT_PORT, null, null);

bool asyncConnectSuccess = conn.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5));
//bool asyncConnectSuccess = conn.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5));

if (!asyncConnectSuccess)
throw new Exception("Gazepoint timed out while connecting (Most likely there is no Gazepoint device available)");
//if (!asyncConnectSuccess)
// throw new Exception("Gazepoint timed out while connecting (Most likely there is no Gazepoint device available)");

Client.Connect(GAZEPOINT_ADDRESS, GAZEPOINT_PORT);
Reader = new System.IO.StreamReader(Client.GetStream());
Expand All @@ -56,11 +56,13 @@ public GazePointTracker()
}
catch (System.Net.Sockets.SocketException e)
{
Console.WriteLine(e);
Console.WriteLine("Gaze Point not connected!");
Client = null;
}
catch (Exception e)
{
Console.WriteLine(e);
Console.WriteLine("Gaze Point Connection Failed!");
Console.WriteLine(e.ToString());
Client = null;
Expand Down