Пример #1
0
            /// <summary>
            /// When a client connects to the server
            /// </summary>
            /// <param name="s"></param>
            /// <param name="new_client"></param>
            /// <returns></returns>
            public bool ClientConnect(RedCorona.Net.Server s, ClientInfo new_client)
            {
                new_client.Delimiter = "\n";
                new_client.OnRead   += ReadClient; //Read client messages
                new_client.OnClose  += New_client_OnClose;
                Player np = new Player(new_client.ID);

                PlayerLookup.Add(new_client.ID, np); // Add a client to our listing.
                ClientTable.Add(new_client.ID, new_client);
                OurServer.PlayerConnected(np);
                return(true);
            }
Пример #2
0
 bool ClientConnect(Server serv, ClientInfo new_client)
 {
     new_client.Delimiter = "\n";
     new_client.OnRead += new ConnectionRead(ReadData);
     return true; // allow this connection
 }
Пример #3
0
 public void Start()
 {
     server = new Server(2345, new ClientEvent(ClientConnect));
 }
Пример #4
0
 /// <summary>
 /// Start a new server
 /// </summary>
 public void StartServer()
 {
     Server_ = new RedCorona.Net.Server(PORT, new ClientEvent(ClientConnect));
 }
Пример #5
0
 bool ClientConnect(Server serv, ClientInfo new_client)
 {
     new_client.MessageType = MessageType.CodeAndLength;
     new_client.OnReadMessage += new ConnectionReadMessage(ReadMessage);
     return true; // allow this connection
 }
Пример #6
0
 bool ClientConnect(Server s, ClientInfo ci)
 {
     ci.Delimiter = "\r\n\r\n";
     ci.Data = new ClientData(ci);
     ci.OnRead += new ConnectionRead(ClientRead);
     ci.OnReadBytes += new ConnectionReadBytes(ClientReadBytes);
     return true;
 }
Пример #7
0
 public HttpServer(Server s)
 {
     this.s = s;
     s.Connect += new ClientEvent(ClientConnect);
     handlers.Add(new FallbackHandler());
 }
Пример #8
0
 public void disconnect()
 {
     server.Close();
     server = null;
 }