Article View: comp.unix.programmer
Article #53Re: Socket Programming Help
From: Barry Margolin
Date: Wed, 04 Nov 1992 22:23
Date: Wed, 04 Nov 1992 22:23
22 lines
1344 bytes
1344 bytes
In article <1992Nov4.143004.22495@nuscc.nus.sg> scstech@solomon.technet.sg (Kenneth Soh) writes:
>I keep having "Address already in use" (errno 48) problem
>everytime I restart the deamon with the same port number -
>the bind() function returns error. The same port number
>seems to be "released" and re-usable after say, half an
>hour.
Specify the SO_REUSEADDR socket option after you create the socket. By
default, the old socket stays around in the TIME-WAIT state for a while so
that the system can reject retransmissions from old connections.
>Also... can someone tell me when should we use shutdown() ?
>I've tried to use it but I don't really understand what it
>is used for.
You use shutdown(2) when you want to close only one direction of
communication. This is pretty rare.
--
Barry Margolin
System Manager, Thinking Machines Corp.
barmar@think.com {uunet,harvard}!think!barmar
Technical Details
Message-ID:
<1d9ihpINNep8@early-bird.think.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!gumby!yale!yale.edu!think.com!barmarReferences:
<1992Nov4.143004.22495@nuscc.nus.sg>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!yale!yale.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.unix.programmer Subject: Re: Socket Programming Help Date: 4 Nov 1992 22:23:53 GMT Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 22 Message-ID: <1d9ihpINNep8@early-bird.think.com> References: <1992Nov4.143004.22495@nuscc.nus.sg> NNTP-Posting-Host: telecaster.think.com