Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. public void Initialize()
  2.         {
  3.             this.ServerAddress = Configuration.ServerAddress;
  4.             this.Port = Configuration.Port;
  5.  
  6.             this.Listener = new TcpListener(this.Port);
  7.  
  8.             this.Client = default(TcpClient);
  9.  
  10.             this.Encoder = new ASCIIEncoding();
  11.         }
  12.         public void Start()
  13.         {
  14.             this.Accept = new Thread(delegate() { AcceptClient(this.Client, this.Listener, this.Stream, this.Encoder); });
  15.  
  16.             this.Accept.Start();
  17.  
  18.             this.Online = true;
  19.         }
  20.         public void AcceptClient(TcpClient client, TcpListener listener, NetworkStream stream, ASCIIEncoding encoder)
  21.         {
  22.             listener = new TcpListener(this.Port);
  23.             listener.Start();
  24.  
  25.             while (true)
  26.             {
  27.                 client = listener.AcceptTcpClient();
  28.  
  29.                 this.Auth = new Thread(delegate() { Authentificate(client, stream, encoder); });
  30.                 this.Auth.Start();
  31.             }
  32.         }
  33.         public void Authentificate(TcpClient client, NetworkStream networkstream, ASCIIEncoding encoder)
  34.         {
  35.             this.Splits = this.RecieveMessage(client, networkstream, encoder).Split('#');
  36.  
  37.             if (this.Splits[1] == "Login")
  38.             {
  39.                 this.Login(client, networkstream, encoder);
  40.             }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement