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 >> it's something I needed to do. If somebody in this thread >> actually does need to do it, I'd be curious bout why... > > 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 */ > if(bind(s, (struct sockaddr *)&data_source, sizeof(data_source)) < 0) > ERROR; > ... > if(connect(s, > (struct sockaddr *)&info->def_addr, > sizeof(struct sockaddr_in)) < 0 > ) > ERROR; > > I've no idea what "multi-homing problems" are, but maybe it gives you > some hint? 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 must "support the use of the default data port [port 20]" or something like that. But, it's not all all clear to me what that is supposed to mean. My reading is that they must support the default port as the destination port for a data connection untill it's been changed by receipt of a PORT command. But, like I said, is very vague, and I suppose some client implementor could have read it as the server must use the default data port as the source port for a data connection. -- Grant Edwards grante Yow! Ha ha Ha ha Ha ha at Ha Ha Ha Ha -- When will I visi.com EVER stop HAVING FUN?!! -- http://mail.python.org/mailman/listinfo/python-list