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.

BTW, you should check for errno == EINTR when select() returns -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

Reply via email to