Example #1
0
        public void Listen(string adress, int port, int max_connections = 10)
        {
            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(new IPEndPoint(IPAddress.Parse(adress), port));

            socket.Listen(max_connections);

            while (true)
            {
                Socket new_connection = socket.Accept();
                Task.Run(() => { NetworkSocket.Run(new_connection); });
            }
        }
Example #2
0
 public void SendMessage(string message)
 {
     NetworkSocket.Send(socket, message);
 }