Re(2): errno 40 (EMSGSIZE, message too long)
Re(2): errno 40 (EMSGSIZE, message too long)
- Subject: Re(2): errno 40 (EMSGSIZE, message too long)
- From: "Peter Lovell" <email@hidden>
- Date: Sat, 25 Jan 2003 18:25:50 -0500
>
>> 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 )
>
{
>
boolean_t funnel_state;
>
int err;
>
struct mbuf* sendBuf;
>
static int recursed = 0;
>
>
// Grab the network flock.
>
funnel_state = thread_funnel_set( network_flock, TRUE );
>
>
// Allocate a new mbuf to hold the data.
>
sendBuf = m_get( M_DONTWAIT, MT_DATA );
>
if ( sendBuf != NULL )
>
{
>
m_copyback( sendBuf, 0, sizeof(struct NPFDaemonMessageData), inData );
>
>
// Send the data. This will dispose of the mbuf, regardless of
>
success.
>
err = sosend( gNKEInfo.sCommSocket, (struct
>
sockaddr*)(&gNKEInfo.sCommAddress), NULL, (void *)sendBuf, NULL, M_WAIT
>
);
>
>
// Restore the funnel.
>
thread_funnel_set( network_flock, funnel_state );
>
if ( err != KERN_SUCCESS )
>
{
>
log( LOG_ERR, "Could not send message (%u) to the daemon (%d). You
>
should restart the computer.\n", inData->sHeader.sCommandID, err );
>
if ( recursed == 0 )
>
{
>
// If an error occurs, try again after sleeping
>
...
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.
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.
Cheers.....Peter
_______________________________________________
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.