Пример #1
0
        public static void listen(string name, int port)
        {
            if (network != null) { // IDLE / DC state
                disconnect();
                return;
            }

            network = new Network(true);
            network.accept(port);
        }
Пример #2
0
        public static void connect(string name, string hostname, int port)
        {
            if (network != null) { // IDLE / DC state
                disconnect();
                return;
            }

            network = new Network();
            network.connect(hostname, port);
            network.sendPacket(Packet.NAME_PACKET, Utils.stringToBytes(name));
        }
Пример #3
0
 public static void disconnect()
 {
     network.disconnect();
     network = null;
 }