public void Listen(IPEndPoint hostEndPoint) { InternalSocket.Bind(hostEndPoint); InternalSocket.Listen(100); InternalSocket.BeginAccept(AcceptCallback, this); }
public void Listen(int port) { InternalSocket.Bind(new IPEndPoint(IPAddress.Any, port)); InternalSocket.Listen(100); InternalSocket.BeginAccept(AcceptCallback, this); }
public void Start() { try { InternalSocket.Bind(ServerEndPoint); InternalSocket.Listen(500); InternalSocket.BeginAccept(EndAccepting, null); } catch (SocketException ex) { if (ex.ErrorCode == (int)SocketError.AddressAlreadyInUse) { throw new InvalidOperationException("The selected port is already used by another process"); } throw new NotSupportedException("oops unexpected error was thrown please report this issue to the developer."); } }