sendto is returning ENOBUF

Posted by user338159 on Stack Overflow See other posts from Stack Overflow or by user338159
Published on 2010-05-11T10:46:42Z Indexed on 2010/05/11 11:14 UTC
Read the original article Hit count: 217

Filed under:
|
|

Hi,

I am currently running an old system on Tru64 which involves lots of UDP sockets using the sendto() function. The sockets are used in our code to send messages to/from various processes and then eventually on to a thick client app that is connected remotely. Occasionally the socket to the thick client gets stuck, this can cause some of these messages to get built up. My question is how can I determine the current buffer size, and how do I determine the maximum message buffer. The code below gives a snippet of how I set up the port and use the sendto function.

/* need to adjust the maximum size we can send on this / / as it needs to be able to cope with the biggest / / messages we send / lenlen = sizeof(len) ; / allow double for when the system is under load */ len = 2 * C_MAX_MESSAGE_DATA_SIZE ; lpos_setsockopt(FATAL, msg_socket,SOL_SOCKET, SO_SNDBUF, &len, lenlen, &error_no) ;

result = sendto( msg_socket,
                     (char *)message,
                     (int)message_len,
                     flags,
                     dest_addr,
                     addrlen);

Note. We have ported this application to Linux and the problem does not seem to appear there.

Any help would be greatly appreciated.

Regards

© Stack Overflow or respective owner

Related posts about sockets

Related posts about unix