• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bind of UDP socket problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Apple-ized Languages
  • Next by Date: Re: How To Remove ALL Breakpoints?
  • Previous by thread: Bind of UDP socket problem
  • Next by thread: Re: Static data -- thanks
  • Index(es):
    • Date
    • Thread