On 13 Jun 1999, Dag-Erling Smorgrav wrote:

> Brian Feldman <gr...@unixhelp.org> writes:
> > On 13 Jun 1999, Dag-Erling Smorgrav wrote:
> > > connect() normally uses the 1024-5000 range. Try the following:
> > > 
> > > # sysctl -w net.inet.ip.portrange.last=40000
> > > 
> > > and see if it solves the EAGAIN problem.
> > 
> > Actually, this is the perfect explanation. I think that this should go in
> > the FAQ. Why in the world are we limiting the ports we can use other than
> > from 1-1023?
> 
> I have no idea. The only use I've ever had for this is the
> predictability of FTP data port numbers, since ftpd will normally use
> the high range (49152-65535). Useful for designing firewalls, and if
> you don't like opening such a wide port range, you can whittle it down
> to a handful (say, one thousand) of ports with judicious use of sysctl.
> 
> I couldn't find any reference to this in RFC 793, 1122, 1123, 1700 or
> 2577. Remind me to build a glimpse index of my RFC collection...
> 
> This still doesn't explain select()'s failure to time out, although I
> should point out that you forgot to increase FD_SETSIZE before
> including <sys/types.h>, and I'm not sure your computation of
> highestsock is correct, since there's no guarantee that fdvec is
> sorted. I haven't tested your code though, I just looked over it
> quickly.

I have two copies. One has FD_SETSIZE increased to 30004 and a vector size
of 30000. The other has FD_SETSIZE default (1024) and a vector of 512.
The guarantee of fdvec is sorted is that Unix behavior is to allocate the
next available fd, so highestsock is correct. The program is correct,
except I didn't have a linefeed in the select() status printing, so it DID
time out successfully, but you didn't see the status report.

> 
> BTW, you should check for errno == EINTR when select() returns -1.

The perror() is the status report for select() when -1.

> 
> DES
> -- 
> Dag-Erling Smorgrav - d...@flood.ping.uio.no
> 
> 
> To Unsubscribe: send mail to majord...@freebsd.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 

 Brian Feldman                _ __ ___ ____  ___ ___ ___  
 gr...@unixhelp.org                _ __ ___ | _ ) __|   \ 
     FreeBSD: The Power to Serve!      _ __ | _ \._ \ |) |
         http://www.freebsd.org           _ |___/___/___/ 
 "<green_> THAT'S WRONG WRONG WRONG!"



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to