Bind of UDP socket problem
Bind of UDP socket problem
- Subject: Bind of UDP socket problem
- From: <email@hidden>
- Date: Mon, 5 Jul 2004 17:09:47 +0200
- Thread-topic: Bind of UDP socket problem
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.
Here is my code:
int sock = -1;
int optval = 1;
struct sockaddr_in bindAddress;
sock = socket(AF_INET, SOCK_DGRAM, 0);
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optval));
bindAddress.sin_family = AF_INET;
bindAddress.sin_port = htons(5060);
bindAddress.sin_addr.s_addr = inet_addr("193.5.229.180");
int nRet = bind(sock, (struct sockaddr*)&bindAddress, sizeof(sockaddr));
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?
Thank you.
Cidric Pillonel
_______________________________________________
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.