Re: Outbound port on sockets

2006-09-17 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > As I mentioned if the posting you made a partial quote from, the > original specification of port-mode FTP has the server making a data > connection from its port 20 to the client port identified by the > client's PORT command. This is TCP port 20? What

Re: Outbound port on sockets

2006-09-17 Thread Steve Holden
Bryan Olson wrote: > Steve Holden wrote: > >>Grant Edwards wrote: >> Well, one of ftpd implementations I have here (C code from RTEMS) does this: /* anchor socket to avoid multi-homing problems */ data_source = info->ctrl_addr; data_source.sin_port = htons(2

Re: Outbound port on sockets

2006-09-17 Thread Bryan Olson
Steve Holden wrote: > Grant Edwards wrote: >>> Well, one of ftpd implementations I have here (C code from RTEMS) does >>> this: >>> >>> /* anchor socket to avoid multi-homing problems */ >>> data_source = info->ctrl_addr; >>> data_source.sin_port = htons(20); /* ftp-data port */ >>>

Re: Outbound port on sockets

2006-09-17 Thread Bryan Olson
Grant Edwards wrote: > Diez B. Roggisch wrote: [Bryan Olson had written:] >>> It's not the issue here, but to specify the outgoing port >>> call bind(('', portnum)) before connect(). >> I wasn't aware of that. Cool. > > It's an interesting thing to know, but I've been doing TCP > stuff for many ye

Re: Outbound port on sockets

2006-09-17 Thread Jorgen Grahn
On Thu, 14 Sep 2006 18:21:39 +0200, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > bmearns wrote: ... > (and before you proceed, reading > > http://cr.yp.to/ftp/security.html > > is also a good idea. And RFC1123, and any number of FTP-related RFCs. There's even one fairly early RFC that encourag

Re: Outbound port on sockets

2006-09-15 Thread Grant Edwards
On 2006-09-15, Steve Holden <[EMAIL PROTECTED]> wrote: >> I don't know what "multi-homing problems are either". >> Apparently there must be some ftp clients that require the >> source port for the data connection to be port 20. >> >> The RFC is pretty vague. It does say the server and clinet but

Re: Outbound port on sockets

2006-09-15 Thread Steve Holden
Grant Edwards wrote: > On 2006-09-15, Sergei Organov <[EMAIL PROTECTED]> wrote: > > >It's not the issue here, but to specify the outgoing port >call bind(('', portnum)) before connect(). > > >>>It's an interesting thing to know, but I've been doing TCP >>>stuff for many years and never

Re: Outbound port on sockets

2006-09-15 Thread Grant Edwards
On 2006-09-15, Sergei Organov <[EMAIL PROTECTED]> wrote: It's not the issue here, but to specify the outgoing port call bind(('', portnum)) before connect(). >> It's an interesting thing to know, but I've been doing TCP >> stuff for many years and never run across a situation where >> i

Re: Outbound port on sockets

2006-09-15 Thread Sergei Organov
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2006-09-15, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > Is it possible to specify which port to use as the outbound port on a > connection? >>> [...] > Specifically, I'm trying to write an FTP host, and I'm trying to > implement t

Re: Outbound port on sockets

2006-09-15 Thread Grant Edwards
On 2006-09-15, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Is it possible to specify which port to use as the outbound port on a connection? >> [...] Specifically, I'm trying to write an FTP host, and I'm trying to implement the PORT command. >>> >>> AFAIK you neither can't d

Re: Outbound port on sockets

2006-09-15 Thread Diez B. Roggisch
Bryan Olson schrieb: > Diez B. Roggisch wrote: >> bmearns schrieb: >>> Is it possible to specify which port to use as the outbound port on a >>> connection? > [...] >>> Specifically, I'm trying to write an FTP host, and I'm trying to >>> implement the PORT command. >> >> AFAIK you neither can't d

Re: Outbound port on sockets

2006-09-14 Thread Bryan Olson
Diez B. Roggisch wrote: > bmearns schrieb: >> Is it possible to specify which port to use as the outbound port on a >> connection? [...] >> Specifically, I'm trying to write an FTP host, and I'm trying to >> implement the PORT command. > > AFAIK you neither can't do that nor need it. It's not t

Re: Outbound port on sockets

2006-09-14 Thread Fredrik Lundh
bmearns wrote: > All the same, it's a good suggestion. Thank you. Now do you know how I > (as the server) can force clients to use PASV, instead of PORT? have you tried returning a suitable error code ? (502 should be a good choice). (and before you proceed, reading http://cr.yp.to/ftp/s

Re: Outbound port on sockets

2006-09-14 Thread bmearns
> But you can restrict the numbers of ports the server will use to a > certain range! It's common for ftp to allow only for so many connections > at the same time, so reserve a port-range of 20 or so for your server > and configure the router to forward them. Thanks, I think that'll have to be my

Re: Outbound port on sockets

2006-09-14 Thread Diez B. Roggisch
bmearns schrieb: > Passive mode is implemented, the client isn't trying to use it. > Besides, that doesn't really help me anyway, all it means is that I > have to resolve port forwarding for the server, instead of for the > client. > > I think what this basically comes down to is that either with

Re: Outbound port on sockets

2006-09-14 Thread Steve Holden
billie wrote: [...] > The right format of a FTP PORT command is: > > PORT x,x,x,x,y,z > > where x(s) represents your IP address in dotted form and (x * y) the > TCP port you bind. That's actually x*256 + y - tou're makling a 16-bit unsigned integer from two bytes. > For further informations

Re: Outbound port on sockets

2006-09-14 Thread bmearns
It's actually 256*y + z billie wrote: > > The right format of a FTP PORT command is: > > > > PORT x,x,x,x,y,z > > > > ...where x(s) represents your IP address in dotted form and (x * y) the > > TCP port you bind. > > Sorry, I wanted to say: (y * z) -- http://mail.python.org/mailman/listinfo/pyth

Re: Outbound port on sockets

2006-09-14 Thread bmearns
Passive mode is implemented, the client isn't trying to use it. Besides, that doesn't really help me anyway, all it means is that I have to resolve port forwarding for the server, instead of for the client. I think what this basically comes down to is that either with PASV or PORT, there's a relat

Re: Outbound port on sockets

2006-09-14 Thread Sergei Organov
"bmearns" <[EMAIL PROTECTED]> writes: > Quick follow up, I'm able to connect to other external FTP sites behind > my firewall and router, no problem. You've been told already to implement PASV command in your server (then client will be able to use so called passive mode). -- Sergei. -- http:/

Re: Outbound port on sockets

2006-09-14 Thread bmearns
Quick follow up, I'm able to connect to other external FTP sites behind my firewall and router, no problem. -Brian bmearns wrote: > Thanks for all the responses. I understood what the PORT command was > for, but I've been seeing alot of doc online that only mentions going > outbound on port 20 f

Re: Outbound port on sockets

2006-09-14 Thread bmearns
Thanks for all the responses. I understood what the PORT command was for, but I've been seeing alot of doc online that only mentions going outbound on port 20 for data connections, so I thought maybe that was my problem. Sorry if this is the wrong spot to follow up on this not-so-much-python matte

Re: Outbound port on sockets

2006-09-14 Thread billie
> The right format of a FTP PORT command is: > > PORT x,x,x,x,y,z > > ...where x(s) represents your IP address in dotted form and (x * y) the > TCP port you bind. Sorry, I wanted to say: (y * z) -- http://mail.python.org/mailman/listinfo/python-list

Re: Outbound port on sockets

2006-09-14 Thread billie
bmearns wrote > Is it possible to specify which port to use as the outbound port on a > connection? I have the IP address and port number for the computer I'm > trying to connect to (not listening for), but it's expecting my > connection on a certain port. > > Specifically, I'm trying to write an

Re: Outbound port on sockets

2006-09-14 Thread Diez B. Roggisch
bmearns schrieb: > Is it possible to specify which port to use as the outbound port on a > connection? I have the IP address and port number for the computer I'm > trying to connect to (not listening for), but it's expecting my > connection on a certain port. > > Specifically, I'm trying to write

Re: Outbound port on sockets

2006-09-14 Thread Fredrik Lundh
"bmearns" wrote: > Specifically, I'm trying to write an FTP host, and I'm trying to > implement the PORT command. From everything I've read, the client > supplies the IP address and port number for where I'm supposed to > connect to send it data (like a LISTing), and it's expecting me to > connect

Outbound port on sockets

2006-09-14 Thread bmearns
Is it possible to specify which port to use as the outbound port on a connection? I have the IP address and port number for the computer I'm trying to connect to (not listening for), but it's expecting my connection on a certain port. Specifically, I'm trying to write an FTP host, and I'm trying t