public ConnectionUDP(Route route, string dstHost, int dstPort, int mode, int connectId, ClientControl clientControl) { MyClientControl = clientControl; MyRoute = route; DstHost = dstHost; DstPort = dstPort; Mode = mode; ConnectId = connectId; try { MySender = new Sender(this); MyRecevier = new Receiver(this); Uos = new UDPOutputStream(this); Uis = new UDPInputStream(this); /* if (mode == 2) { route.CreateTunnelProcessor().Process(this); } */ } catch (Exception e) { _connected = false; route.ConnTable.Remove(connectId); lock (this) { Monitor.PulseAll(this); } throw (e); } }
public ClientManager(Route route) { MyRoute = route; MainThread = new Thread(new ThreadStart(() => { while (true) { // try Thread.Sleep(1000); ScanClientControl(); } })); MainThread.Start(); }
static void Main(string[] args) { Route client = new Route(1, 150); Route server = new Route(2, 150); }