Example #1
0
 public void Listen(int port)
 {
     var server = new TcpServerSocket();
     server.OnClientConnect += onConnected;
     server.Listen(port);
     socket = server;
 }
Example #2
0
 public void Connect(IPAddress ip, int port)
 {
     var client = new TcpClientSocket();
     client.OnConnect += onConnected;
     client.Connect(ip, port);
     socket = client;
 }
Example #3
0
        public void Listen(int port)
        {
            var server = new TcpServerSocket();

            server.OnClientConnect += onConnected;
            server.Listen(port);
            socket = server;
        }
Example #4
0
        public void Connect(IPAddress ip, int port)
        {
            var client = new TcpClientSocket();

            client.OnConnect += onConnected;
            client.Connect(ip, port);
            socket = client;
        }
Example #5
0
 static void initServer(string[] args)
 {
     int port = 0;
     try {
         port = int.Parse(args[1]);
         var server = new TcpServerSocket();
         server.OnDisconnect += onDisconnect;
         server.Listen(port);
         _socket = server;
         start();
     } catch (Exception) {
         Console.WriteLine("Invalid port");
     }
 }
Example #6
0
 static void initClient(string[] args)
 {
     IPAddress ip = null;
     int port = 0;
     try {
         ip = IPAddress.Parse(args[1]);
         port = int.Parse(args[2]);
         var client = new TcpClientSocket();
         client.OnDisconnect += onDisconnect;
         client.Connect(ip, port);
         _socket = client;
         start();
     } catch (Exception) {
         Console.WriteLine("Please specify a valid ip and port");
     }
 }