Re: Bind of UDP socket problem
Re: Bind of UDP socket problem
- Subject: Re: Bind of UDP socket problem
- From: Justin Walker <email@hidden>
- Date: Mon, 5 Jul 2004 09:31:53 -0700
On Jul 5, 2004, at 8:09, email@hidden wrote:
I have a problem with bind() and UDP socket. When trying to bind the
socket I always get the error 49 = Can't assign requested address.
[snip]
bind() always fails with errno=49 "can't assign requested address".
The address "193.5.229.180" is the correct one, it is my local
address. I could give INADDR_ANY (which works) but giving the IP
address should work too.
I have Mac OS X 10.3.4. Is this a bug of Apple? What do I wrong?
It is a bug in your code. Since your 'sockaddr' is allocated on the
stack, it is full of random junk. You should always clear out such
structures before use:
bzero((char *)&bindAddress, sizeof bindAddress);
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | When LuteFisk is outlawed
| Only outlaws will have
| LuteFisk
*--------------------------------------*-------------------------------*
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.