Subj : Re: Socket behind Natting routers To : comp.programming From : bill-godfrey Date : Mon Jul 25 2005 02:14 pm "al912912" wrote: > Is it possible to open a socket between 2 computers that are behind two > natting routers (one for each computer)? If so, how? There's port forwarding and reflector servers which others have mentioned. Another trick is to (ab)use UDP to fool each NAT router into thinking that they are both the client. Nodes A and B are each behind a NAT router, A' and B'. A wants to contact B. A sends a UDP packet with a source port of 1234 and a destination port of 5678. A' picks up the packet and retransmits it with its own IP address, recording that any responses to port 1234 from B are to be routed to A. At the same time, B sends a UDP packet to A with a source port of 5678 and a destination port of 1234. B' picks up the packer and retransmits it with its own IP address, recording that any responses to port 5678 from A are to be routed to A. It works because a new UDP message looks just like a response. (It won't with TCP because connecting and responding to a connection are very different.) The tricky bit is getting A and B to know what port numbers to use without talking to each other directly. Bill, gargling. -- http://billpg.me.uk/ usenet(at)billpg(dot)me(dot)uk .