Re: UDP packets to PC behind NAT

2006-09-16 Thread John J. Lee
"Janto Dreijer" <[EMAIL PROTECTED]> writes: > Steve Holden wrote: > > Note that TCP and UDP port spaces are disjoint, so there's no way for > > TCP and UDP to use "the same port" - they can, however, use the same > > port number. Basically the TCP and UDP spaces have nothing to do with > > each ot

Re: UDP packets to PC behind NAT

2006-09-16 Thread Paul Rubin
"Janto Dreijer" <[EMAIL PROTECTED]> writes: > > Most dynamic NAT gateways will respond to an outgoing UDP datagram by > > mapping the internal client's UDP port to a UDP port on the NAT > > gateway's external interface, and setting a converse mapping that will > > allow the server to respond, even

Re: UDP packets to PC behind NAT

2006-09-16 Thread Grant Edwards
On 2006-09-16, Janto Dreijer <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: >> Note that TCP and UDP port spaces are disjoint, so there's no way for >> TCP and UDP to use "the same port" - they can, however, use the same >> port number. Basically the TCP and UDP spaces have nothing to do with >>

Re: UDP packets to PC behind NAT

2006-09-16 Thread Janto Dreijer
Steve Holden wrote: > Note that TCP and UDP port spaces are disjoint, so there's no way for > TCP and UDP to use "the same port" - they can, however, use the same > port number. Basically the TCP and UDP spaces have nothing to do with > each other. > > Most dynamic NAT gateways will respond to an o

Re: UDP packets to PC behind NAT

2006-09-15 Thread Steve Holden
Janto Dreijer wrote: > Grant Edwards wrote: > >>On 2006-09-15, Janto Dreijer <[EMAIL PROTECTED]> wrote: > > > >>>Would it be a reasonable solution to initiate a TCP connection >>>from the client to the server and somehow (?) let the server >>>figure out how the client is connecting? And the

Re: UDP packets to PC behind NAT

2006-09-15 Thread Jean-Paul Calderone
On 15 Sep 2006 00:32:49 -0700, Janto Dreijer <[EMAIL PROTECTED]> wrote: >This is probably more of a networking question than a Python one, but >it would be nice to know if someone has done this with Python's socket >module. And besides one usually gets more information from c.l.py than >anywhere el

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Grant Edwards wrote: > On 2006-09-15, Janto Dreijer <[EMAIL PROTECTED]> wrote: ... > > Would it be a reasonable solution to initiate a TCP connection > > from the client to the server and somehow (?) let the server > > figure out how the client is connecting? And then send UDP to > > client over th

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Grant Edwards wrote: > On 2006-09-15, Christophe <[EMAIL PROTECTED]> wrote: > > > Initiate an UDP connection from the client to the server and > > have the server send back the UDP packets to the address you > > get in the "recvfrom" result. > > There's no such thing as a "UDP connection", so I don

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Oops. That second UDPSock = socket(...) in the server.py shouldn't be there. Janto Dreijer wrote: > Awesome! I haven't tested it on the actual server but I think it works. > Thanks! > I prefer a TCP connection solution and will post one if it works. > > server.py > > from socket import *

Re: UDP packets to PC behind NAT

2006-09-15 Thread Grant Edwards
On 2006-09-15, Janto Dreijer <[EMAIL PROTECTED]> wrote: > I have a server with a static "public" IP and a client behind a NAT. I > would like to send UDP packets from the server to the client. So what I > need to do is open up a "hole" in the NAT and let the server know the > target IP and port of

Re: UDP packets to PC behind NAT

2006-09-15 Thread Grant Edwards
On 2006-09-15, Christophe <[EMAIL PROTECTED]> wrote: > Initiate an UDP connection from the client to the server and > have the server send back the UDP packets to the address you > get in the "recvfrom" result. There's no such thing as a "UDP connection", so I don't understand what you're suggest

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Awesome! I haven't tested it on the actual server but I think it works. Thanks! I prefer a TCP connection solution and will post one if it works. server.py from socket import * print "listening" UDPSock = socket(AF_INET, SOCK_DGRAM) UDPSock.bind(("localhost", 1234)) # visibility to outsid

Re: UDP packets to PC behind NAT

2006-09-15 Thread Christophe
Janto Dreijer a écrit : > This is probably more of a networking question than a Python one, but > it would be nice to know if someone has done this with Python's socket > module. And besides one usually gets more information from c.l.py than > anywhere else :) > > I have a server with a static "pu

UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
This is probably more of a networking question than a Python one, but it would be nice to know if someone has done this with Python's socket module. And besides one usually gets more information from c.l.py than anywhere else :) I have a server with a static "public" IP and a client behind a NAT.