Winsock Error Codes - Brought to you by Winsock-Error.com

10040 "Message too long."

WSAEMSGSIZE (Winsock error number: 10040)

Microsoft say this about Winsock error 10040 - WSAEMSGSIZE:

A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.

Full details of Winsock TCP error 10040 - WSAEMSGSIZE:

Berkeley description: A message sent on a socket was larger than the internal message buffer or some other network limit.

WinSock description: Similar to Berkeley.

Detailed description:

recv() and recvfrom(): if the datagram you read is larger than the buffer you supplied, then WinSock truncates the datagram (i.e. copies what it can into your buffer) and fails the function.

send() and sendto(): you cannot send a datagram as large as you've requested. Note that the v1.1 WinSock specification does not explicitly state that this error occurs if the value you request is larger than the WSAData.iMaxUdpDg returned from. Since the buffering requirements for sending are less than for receiving datagrams, it's conceivable that you can send a datagram larger than you can receive.

   
This page is designed to help you to understand Winsock TCP error 10040. It will not necessarily mean you can instantly fix issues when your computer tells you that Winsock is having problems with code 10040, rather it will give you the necessary background information to help solve the matter.

Programming declarations for 10040 (WSAEMSGSIZE):

C#
long WSAEMSGSIZE = 10040 ;

VB.net
Dim WSAEMSGSIZE As Long = 10040

VB6
Dim WSAEMSGSIZE As Long
WSAEMSGSIZE = 10040