public static void listen(string name, int port) { if (network != null) { // IDLE / DC state disconnect(); return; } network = new Network(true); network.accept(port); }
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)); }
public static void disconnect() { network.disconnect(); network = null; }