Ejemplo n.º 1
0
        private IoHandler MakeBrokerConnection(IBrokerInfo broker, AMQConnection connection)
        {
            if (broker.UseSSL)
            {
                _connector = new SslSocketConnector();
            }
            else
            {
                _connector = new SocketConnector();
            }

            Stream stream = _connector.Connect(broker);

            return(new IoHandler(stream, connection.ProtocolListener));
        }
Ejemplo n.º 2
0
        public SocketDataHandler Accept(Socket clientSocket)
        {
            Socket serverSocket = new Socket(cdServerEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

            if (connector == null)
            {
                serverSocket.Connect(cdServerEndPoint);
            }
            else
            {
                connector.Connect(serverSocket, cdServerEndPoint);
            }

            GameClientDataHandler dataHandler = new GameClientDataHandler(nextID, clientSocket, serverSocket);

            selectServer.AddDataSocket(serverSocket, dataHandler.DataFromServer);

            //Console.WriteLine("[INFO] New Client/Server {0}", nextID);
            nextID++;
            return(dataHandler.DataFromClient);
        }