/// <summary> /// Begin listening for TCP connections. Should not be called directly - instead use <see cref="Start"/> /// <seealso cref="TCPEnabled"/> /// </summary> protected void StartTCP() { if (!TcpEnabledEnabled && _running) { VerifyEndpointAddress(TcpEndPoint); _tcpListen = new Socket(TcpEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { _tcpListen.Bind(TcpEndPoint); } catch (Exception ex) { log.Error("Could not bind to Address {0}: {1}", TcpEndPoint, ex); return; } _tcpListen.Listen(MaximumPendingConnections); SocketHelpers.SetListenSocketOptions(_tcpListen); // We pass null the first time to create the arg StartAccept(null); TcpEnabledEnabled = true; Info(null, Resources.ListeningTCPSocket, TcpEndPoint); } }
/// <summary> /// Begin listening for TCP connections. Should not be called directly - instead use <see cref="M:Cell.Core.ServerBase.Start(System.Boolean,System.Boolean)" /> /// <seealso cref="P:Cell.Core.ServerBase.TCPEnabled" /> /// </summary> protected void StartTCP() { if (this.TcpEnabledEnabled || !this._running) { return; } ServerBase.VerifyEndpointAddress(this.TcpEndPoint); this._tcpListen = new Socket(this.TcpEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { this._tcpListen.Bind((EndPoint)this.TcpEndPoint); } catch (Exception ex) { ServerBase.log.Error("Could not bind to Address {0}: {1}", (object)this.TcpEndPoint, (object)ex); return; } this._tcpListen.Listen(this.MaximumPendingConnections); SocketHelpers.SetListenSocketOptions(this._tcpListen); this.StartAccept((SocketAsyncEventArgs)null); this.TcpEnabledEnabled = true; this.Info((IClient)null, Cell_Core.ListeningTCPSocket, (object)this.TcpEndPoint); }
/// <summary> /// Begin listening for TCP connections. Should not be called directly - instead use <see cref="M:Cell.Core.ServerBase.Start(System.Boolean,System.Boolean)" /> /// <seealso cref="P:Cell.Core.ServerBase.TCPEnabled" /> /// </summary> protected void StartTCP() { if (TcpEnabledEnabled || !_running) { return; } VerifyEndpointAddress(TcpEndPoint); _tcpListen = new Socket(TcpEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { _tcpListen.Bind(TcpEndPoint); } catch (Exception ex) { log.Error("Could not bind to Address {0}: {1}", TcpEndPoint, ex); return; } _tcpListen.Listen(MaximumPendingConnections); SocketHelpers.SetListenSocketOptions(_tcpListen); StartAccept(null); TcpEnabledEnabled = true; Info(null, Cell_Core.ListeningTCPSocket, (object)TcpEndPoint); }