Open TommySoucy opened 1 year ago
System was mostly done, but ran into issue with reusing socket. Will have to redesign slightly.
C1 connects to IS C2 connects to IS C2 tells IS it wants to connect to C1 IS sends C1's address:port to C2 and C2's address:port to C1 C1 sends UDP packet to C2, presumably from same local endpoint as connection to IS C2 sends UDP packet to C1, presumably from same local endpoint as connection to IS They both keep sending these packets, until they both receive a packet from target endpoint When C1 does, it opens TCP listener on that endpoint (PROBLEM: 2 sockets can't listen to same endpoint, but this endpoint is the one we are listening to through connection to IS) When C2 does, it attempts connection with TCP client to C1's endpoint
Solution 1: Reuse ISClient socket for Server and BeginAccept on it, see if we can accept new connections to that endpoint while the socket is lready connected to IS Solution 2: When we connect to IS, disconnect right after, and then we BeginAccept on a socket to which IS should connect as a client. On client side, we are now always accepting new TCP connections using that socket. This is assuming that once we create and close the connection to IS, we can start listening on the endpoint and it will remain open to the IS until timeout.
System will be rewritten to use UPnP instead of punch through for now. Punch through will only be implemented later as a fallback option in case UPnP port forwarding is not possible
As an alternative to having to use port-forwarding or some other relay solution. Would require a relay server to always be online.