public ServerSocket(IPEndPoint listeningEndPoint, SocketSetting setting, IBufferPool receiveDataBufferPool, Action <ITcpConnection, byte[], Action <byte[]> > messageArrivedHandler) { listeningEndPoint.CheckNotNull("listeningEndPoint"); setting.CheckNotNull("setting"); receiveDataBufferPool.CheckNotNull("receiveDataBufferPool"); messageArrivedHandler.CheckNotNull("messageArrivedHandler"); _listeningEndPoint = listeningEndPoint; _setting = setting; _receiveDataBufferPool = receiveDataBufferPool; _connectionEventListeners = new List <IConnectionEventListener>(); _messageArrivedHandler = messageArrivedHandler; _socket = SocketUtils.CreateSocket(_setting.SendBufferSize, _setting.ReceiveBufferSize); _acceptSocketArgs = new SocketAsyncEventArgs(); _acceptSocketArgs.Completed += AcceptCompleted; _logger = IocManager.Instance.Resolve <ILoggerFactory>().Create(GetType().FullName); }
public static string CreateClientId(IPEndPoint clientEndPoint) { clientEndPoint.CheckNotNull("clientEndPoint"); return(string.Format("{0}@{1}", clientEndPoint.Address, clientEndPoint.Port)); }
public static string ToAddress(this IPEndPoint endpoint) { endpoint.CheckNotNull("endpoint"); return(string.Format("{0}:{1}", endpoint.Address, endpoint.Port)); }