Exemplo n.º 1
0
 protected SocketClientBase(PureServerBase srv, ClientId id, SocketClientParams clParams, byte[] sessionKey)
 {
     Server     = srv;
     Params     = clParams;
     Id         = id;
     SessionKey = sessionKey;
 }
Exemplo n.º 2
0
        private SocketClientBase CreateClient(SocketClientParams clParams)
        {
            var id = new ClientId(clParams);
            var cl = new Client(this, id, clParams, GenerateSessionKey());

            return(cl);
        }
Exemplo n.º 3
0
 private void AcceptLoopProc()
 {
     while (svSocket != null && svSocket.IsBound && !disconnecting)
     {
         Socket clSocket;
         try
         { clSocket = svSocket.Accept(); }
         catch (SocketException) // Disconnect() called
         { break; }
         if (disconnecting)
         {
             break;
         }
         var rawStream = new NetworkStream(clSocket, false);
         var clParams  = new SocketClientParams(clSocket, rawStream.AsUnclosable());
         var allow     = true;
         OnNewClient(clParams, ref allow);
         if (allow)
         {
             var cl = CreateClient(clParams);
             newClients.Enqueue(cl);
         }
         else
         {
             clSocket.Shutdown(SocketShutdown.Both);
             clSocket.Close();
         }
     }
     Root.Log(LogLevel.Info, "Server: disconnected");
     if (semAcceptingThread.CurrentCount == 0)
     {
         semAcceptingThread.Release();
     }
 }
Exemplo n.º 4
0
 public Client(Server srv, ClientId id, SocketClientParams clParams, byte[] sessionKey) :
     base(srv, id, clParams, sessionKey)
 {
     AccessFlags = UserAccess.Default;
 }