Exemplo n.º 1
0
    private void SocketAccept(IAsyncResult _result)
    {
        Socket clientSocket = socket.EndAccept(_result);

        Console.WriteLine("One user connect");

        ServerUnit <T> serverUnit = new ServerUnit <T>();

        lock (noLoginList)
        {
            noLoginList.Add(serverUnit);

            serverUnit.Init(clientSocket, tick);
        }

        BeginAccept();
    }
Exemplo n.º 2
0
    private void SocketAccept(IAsyncResult _result)
    {
        Socket clientSocket = socket.EndAccept(_result);

        Console.WriteLine("One user connected");

        T unit = new T();

        ServerUnit serverUnit = new ServerUnit();

        lock (list)
        {
            list.Add(serverUnit);
        }

        serverUnit.Init(clientSocket, unit);

        unit.Init(serverUnit.SendData);

        BeginAccept();
    }