public SocketProxy(GSConnectionManager gsConnectionManager) { this.gsConnectionManager = gsConnectionManager; IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, ListenPort); var socketSettings = new SocketSettings(maxConnections, backlog, maxAcceptOps, bufferSize, localEndPoint, expireInterval, expireTime); listener = new SocketListener(socketSettings); listener.DataReceived += new ConnectionEventHandler(socketLintener_DataReceived); listener.Connected += new ConnectionEventHandler(socketLintener_Connected); listener.Disconnected += new ConnectionEventHandler(socketLintener_Disconnected); listener.StartListen(); TraceLog.ReleaseWrite("TCP listent is started, The port:{0}.", ListenPort); timer = new Timer(Check, null, proxyCheckPeriod, proxyCheckPeriod); }
public void Init() { IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, port); int maxConnections = 10000; int backlog = 1000; int maxAcceptOps = 10000; int bufferSize = 1024; var socketSettings = new SocketSettings(maxConnections, backlog, maxAcceptOps, bufferSize, localEndPoint, 0, 0); socketListener = new SocketListener(socketSettings); socketListener.Connected += OnConnectCompleted; socketListener.DataReceived += OnReceivedCompleted; socketListener.StartListen(); }