Thread: bridging sockets between NAT gateways

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445

    bridging sockets between NAT gateways

    I have a new task which could easily be accomplished if I can find a way to do the following:

    two computers are connected to the internet through NAT gateways. because of the NAT gateways, they cannot connect directly to each other without manual configuration of the gateways, which I'm hoping to avoid. can the two computers connect to an intermediate server, which somehow enables the two computers to connect directly to each other, similar to forwarding a telephone call? bridging the two sockets internally in the server is a trivial task, but if I could find a way to drop the server out of the picture altogether, once the connection is made, it would improve my state of affairs greatly.
    Last edited by Elkvis; 02-18-2011 at 02:29 PM.

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    90
    It depends on how restrictive the NATs are. Some NATs will allow any host/port to send data back to the same source port on the NAT of a previously sent packet, some only allow the destination host but any port, some only allow the destination host and port. If either NAT allows option 1, you could pull it off, but if not you're SOL. This asumes UDP. For TCP, not sure, but probably won't work.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    after I posted the question, I did a LOT more research and found out about hole punching. I'm half way to a solution now, and hopefully it will work when I finish it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer over sockets
    By adrians in forum C Programming
    Replies: 3
    Last Post: 03-02-2009, 12:56 AM
  2. Best way to poll sockets?
    By 39ster in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-22-2008, 01:43 PM
  3. multiple UDP sockets with select()
    By nkhambal in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-17-2006, 07:36 PM
  4. Raw Sockets and SP2...
    By Devil Panther in forum Networking/Device Communication
    Replies: 11
    Last Post: 08-12-2005, 04:52 AM
  5. Starting window sockets
    By _Cl0wn_ in forum Windows Programming
    Replies: 2
    Last Post: 01-20-2003, 11:49 AM