Пример #1
0
        /// <summary>
        /// Creates a new Connection witht he given information
        /// </summary>
        /// <param name="dataStream">The Socket of the connection</param>
        /// <param name="connectionID">The id of the connection</param>
        public ConnectionInformation(Socket dataStream, int connectionID, SocketManager manager, IDataParser parser, string ip)
        {
            this.parser = parser;
            this.buffer = new byte[GameSocketManagerStatics.BUFFER_SIZE];
            this.manager = manager;
            this.dataSocket = dataStream;
            this.dataSocket.SendBufferSize = GameSocketManagerStatics.BUFFER_SIZE;
            this.ip = ip;
            this.connectionID = connectionID;
            this.sendCallback = new AsyncCallback(sentData);

            if (connectionChanged != null)
                connectionChanged.Invoke(this, ConnectionState.open);

            MessageLoggerManager.AddMessage(null, connectionID, LogState.ConnectionOpen);
        }
Пример #2
0
 public ConnectionHandeling(int port, int maxConnections, int connectionsPerIP, bool enabeNagles)
 {
     liveConnections = new Hashtable();
     manager = new SocketManager();
     manager.init(port, maxConnections, connectionsPerIP, new InitialPacketParser(), !enabeNagles);
 }