private void ListenerLoop() { while (Socket.IsBound && Running) { try { var incoming_socket = Socket.Accept(); var tunnel = new JsonSocketTunnel(incoming_socket); tunnel.MessageReceived += HandleLinkMessage; tunnel.TunnelClosed += HandleLinkClose; tunnel.StartMessageLoop(); IncomingConnections.Add(tunnel); } catch (SocketException ex) { // we're probably unbound Log.Warn("SocketException in ListenerLoop, stopped listening"); Log.Warn(ex); StopListening(); } catch { throw; } } }
public void Connect() { InitializeSocket(); Socket.Connect(SocketEndPoint); Tunnel = new JsonSocketTunnel(Socket); Tunnel.MessageReceived += HandleLinkMessage; Tunnel.StartMessageLoop(); }