Date: Wed, 25 Jun 2003 13:33:45 +0100 (BST) From: Jan Grant <Jan.Grant@bristol.ac.uk> To: Gagan Grewal <gagan_grewal@vsnl.net> Cc: freebsd-questions@freebsd.org Subject: Re: using bind() call on FreeBSD Message-ID: <Pine.GSO.4.44.0306251329570.18900-100000@mail.ilrt.bris.ac.uk> In-Reply-To: <20030623003345.A2921@vsnl.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 23 Jun 2003, Gagan Grewal wrote:
> Hi Folks :)
>
> I am trying to write a simple a server process which follows this sequence...
> socket()
> bind()
> listen()
> accept()
> .
> .
> .
> close( descriptor from accept() )
> close( descriptor from socket() )
>
> But I am getting error 99 (Cannot assign requested address) from bind().
>
> I am trying to bind the socket on 127.0.0.1:3333
> (This works on Linux though)
>
> Are there any special/extra things I need to do in /etc or elsewhere to make
> this program run on FreeBSD ?
>
> I am running FreeBSD 4.7-RELEASE
>
> Any help/pointers from you folks would be great :)
>
> Thanks in advance :)
You don't offer any source code, but people are often "gotcha"'d by the
fact that FreeBSD really means "must be zero" when it describes spare
entries in a sockstat as MBZ. Linux doesn't care.
If you have a
struct sockaddr_in a;
try changing it to
struct sockaddr_in a = {};
- C semantics for structure initialisation mean that unspecified fields
are set to zero.
Cheers,
jan
--
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/
Don't annihilate, assimilate: MacDonalds, not missiles.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.44.0306251329570.18900-100000>
