Re: Re(2): errno 40 (EMSGSIZE, message too long)
Re: Re(2): errno 40 (EMSGSIZE, message too long)
- Subject: Re: Re(2): errno 40 (EMSGSIZE, message too long)
- From: Ryan McGann <email@hidden>
- Date: Sat, 25 Jan 2003 18:27:19 -0800
On Saturday, January 25, 2003, at 03:25 PM, Peter Lovell wrote:
Can anybody tell me why our NKE can receive this error when sending
a
12 byte structure to our daemon? Our messages are infrequent, yet we
get this error 1 in 10 times at least. Putting a tsleep for 5
millseconds in the NKE before calling sosend helps bring down the
odds
to 1 in 5, but that's still quite frequent for a 12 byte message
that's sent at most once per second.
Can you tell us where this error occurs? It's hard to diagnose
without
some salient details.
Sure. My NKE has a listen() callback, and if the socket is bound to a
non-local address I send a message off to the daemon. The code below
is
for my send to daemon. The structure is 12 bytes long.
static void SymSendToDaemon( register struct SymDaemonMessageData
*inData )
{
...
}
Hi Ryan,
I notice you get a regular mbuf and not a packet header. Is this TCP or
UDP (or ???) If this is supposed to be separate than I'd expect to use
a
packet header mbuf.
Just raw. Our socket is created with
err = socreate( AF_UNIX, &gNKEInfo.sCommSocket, SOCK_STREAM, 0 );
if ( err == KERN_SUCCESS )
{
gNKEInfo.sCommAddress.sun_family = AF_UNIX;
strcpy( gNKEInfo.sCommAddress.sun_path, kNPFSocketName );
gNKEInfo.sCommAddress.sun_len = sizeof( gNKEInfo.sCommAddress ) -
sizeof( gNKEInfo.sCommAddress.sun_path ) + strlen(
gNKEInfo.sCommAddress.sun_path );
err = soconnect( gNKEInfo.sCommSocket, (struct sockaddr
*)&gNKEInfo.sCommAddress );
AFAIK IPC sockets don't need to have the TCP/UDP packet headers
prepended to the mbuf.
If that's not the problem then I'd suggest looking at the various
fields
in the mbuf and socket to see what's bad. There are not too many places
which return EMSGSIZE - about fifty or so. Many clearly don't apply, so
it should be too hard to find which test fails and returns the error
to you.
Neither seem to be bad, which is suggested by the fact that the code
works 60% of the time. After about 4 messages from the NKE to the
daemon, the NKE's sosend returns errno=40, but putting in a tsleep
fixes it another 10% of the time. It's the rest of the time that I
can't get to work.
There are 10 kinds of people in the world: those that can understand
binary, and those that can't.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.