public void Start(JobProcessor jobProcessor, IPAddress bindAddress, int port) { if (this.active) { throw new InvalidOperationException("Already activated."); } this.active = true; this.jobProcessor = jobProcessor; this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.Bind(new IPEndPoint(bindAddress, port)); this.socket.Listen(200); this.socket.BeginAccept(0, new AsyncCallback(this.EndAccept), this.socket); this.LocalEndPoint = new IPEndPoint((bindAddress == IPAddress.Any) ? TcpServerBase <TClient> .GetLocalIP(ServerBindType.PublicPrivate) : bindAddress, (this.socket.LocalEndPoint as IPEndPoint).Port); }
public void Start(JobProcessor jobProcessor, ServerBindType bindType, int port) { this.Start(jobProcessor, TcpServerBase <TClient> .GetLocalIP(bindType), port); }