public Listener(IPAddress address, int port) { try { endPoint = new IPEndPoint(address, port); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(endPoint); } catch (SocketException ex) { if (ex.SocketErrorCode == SocketError.AddressAlreadyInUse) { Console.Write("Address and/or port is already in use."); Console.ReadKey(true); Environment.Exit(1); } } threadExecutor = new ThreadExecutor(); threadExecutor.Tick += ListenTick; }
public Client(Socket socket) { Socket = socket; threadExecutor = new ThreadExecutor(); threadExecutor.Tick += ReceiveTick; }
public Client(IPAddress address, int port) { Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); threadExecutor = new ThreadExecutor(); threadExecutor.Tick += ReceiveTick; }