Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net;
- using System.Net.Sockets;
- namespace GameServer
- {
- class Program
- {
- static void Main(string[] args)
- {
- string ServerIP = "192.168.75.128";
- int port = 17635;
- int timer = 0;
- List<Socket> clients = new List<Socket>();
- TcpListener listener = new TcpListener(IPAddress.Parse(ServerIP), port);
- listener.Start();
- while (true)
- {
- if (listener.Pending())
- {
- Socket temporary = listener.AcceptSocket();
- clients.Add(temporary);
- }
- foreach (Socket client in clients)
- {
- byte[] buffer = new byte[client.Available];
- client.Receive(buffer);
- string Received[] = ASCIIEncoding.ASCII.GetString(buffer).Split(";");
- foreach (string cmd in Received)
- {
- if (cmd.Contains("register"))
- {
- string command = cmd.Replace("register: ","") // erase teh register part
- string username = cmd.split(",")[0];
- string password = cmd.split(",")[1];
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement