public void reverseConnect() { System.Net.IPAddress addr = publicAddress; var t = attemptConnection(); if (t != null) { ReliableIncomingConnection c = new ReliableIncomingConnection(t); c.send(new Commands.ReverseConnectionType() { makeControl = true, id = App.theCore.id }); App.theCore.addIncomingConnection(c); } t = attemptConnection(); if (t != null) { ReliableIncomingConnection c = new ReliableIncomingConnection(t); c.send(new Commands.ReverseConnectionType() { makeData = true, id = App.theCore.id }); App.theCore.addIncomingConnection(c); } }
//TODO: Remove old incoming connections when they're dead static void acceptLoop() { while (!disposed) { System.Net.Sockets.TcpClient u = listener.AcceptTcpClient(); Model.IncomingConnection c = new Model.ReliableIncomingConnection(u); theCore.addIncomingConnection(c); } }