/// <summary> /// Creates a thread to run the specified client, receiving data. /// </summary> /// <remarks>This method takes ownership of the client.</remarks> /// <param name="client">The client to send and receive data with.</param> public void RunClient(ProfilerClient client) { if(client == null) throw new ArgumentNullException("client"); if(this.Client != null) throw new InvalidOperationException(); this.Client = client; m_recvThread = new Thread(new ParameterizedThreadStart(ReceiveThread)); m_receive = true; m_recvThread.Start(Client); }
private void Connect() { for(int i = 0; i < m_attempts; ++i) { if(Canceled) break; this.Invoke(new Action<int>(UpdateAttempts), i + 1); try { Client = new ProfilerClient(m_host, m_port, m_data); } catch(System.Net.Sockets.SocketException ex) { this.Invoke(new Action<string>(UpdateStatus), ex.Message); Thread.Sleep(1000); continue; } break; } }
public static bool TestConnection(string host, ushort port, IDataEngine tempEngine) { try { var client = new ProfilerClient(host, port, tempEngine); return true; } catch(System.Net.Sockets.SocketException) { return false; } }