Re: Socket "bind" isn't working for me
Re: Socket "bind" isn't working for me
- Subject: Re: Socket "bind" isn't working for me
- From: Justin Walker <email@hidden>
- Date: Sat, 23 Apr 2005 15:38:46 -0700
Clearing up some bad editing:
On Apr 23, 2005, at 15:34, Justin Walker wrote:
Another thing I didn't mention in my earlier posting was that I was
also setting my
SocketOpt to SO_REUSEADDR and SO_REUSEPORT respectively. In fact,
the EDCommon framework indicates that... in these two method calls
in EDIPSocket.m
[snip]
So why am I getting this error "The socket is already bound to an
address"?
and how can I selectively send data to two remote machines? Not at
the
same time of course, but selectively, using "sendto" - which ALWAYS
returns a -1 instead of the actual number of bytes it would have sent?
You really need to get this straight:
- bind assigns values to the local endpoint; if you don't do it,
the kernel will (assuming you are the client), at the point you
start using the socket. This has zilch to do with the remote
endpoint.
- sendto takes arguments that specify the remote address; that's how
you send to multiple destinations via a datagram socket
The bind() error is the fundamental issue for you. It turns out that
the man page is not completely correct. The call also returns EINVAL
only (AFAICT) if the socket descriptor you
The word "only" snuck in while I was distracted by a passing
fancy...ignore it.
Regards,
Justin
pass in isn't really a socket descriptor, or if there is another
problem with the sockaddr structure you pass in.
Also, two notes on your code:
- although on PowerPC, network and host byte order are the same,
your code should set both the port and the address to network
byte order;
- I think the length value has to be set in the sockaddr
The latter could cause the bind() call to fail.
--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
Some people have a mental horizon of radius zero, and
call it their point of view.
-- David Hilbert
--------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden