public MyClientTcpSocket(Func <string> getHostPort, TimeSpan reconnectTimeOut, int sendBufferSize = 1024 * 1024)
 {
     Logs              = new SocketLog <MyClientTcpSocket <TSocketData> >(this);
     _log              = Logs;
     _getHostPort      = getHostPort;
     _reconnectTimeOut = reconnectTimeOut;
     SetPingInterval(TimeSpan.FromSeconds(3));
     _deliveryBuffer = new byte[sendBufferSize];
 }
示例#2
0
        public MyServerTcpSocket(IPEndPoint ipEndPoint, int sendBufferSize = 1024 *1024)
        {
            if (sendBufferSize < 1024)
            {
                throw new Exception("Buffer size must be more then 1024. Now size:" + sendBufferSize);
            }

            _ipEndPoint     = ipEndPoint;
            _sendBufferSize = sendBufferSize;
            _connections    = new Connections <TSocketData>();

            Logs = new SocketLog <MyServerTcpSocket <TSocketData> >(this);
            _log = Logs;
        }