std::cout<<"WSAETIMEDOUT - Attempt to connect timed out\n"<<std::endl;
break;
caseWSAEINVAL:
std::cout<<"WSAEINVAL - One of the specified parameters was invalid such as the window handle not referring to an existing window, or the specified socket is in an invalid state. "<<std::endl;
break;
caseWSAEINPROGRESS:
std::cout<<"WSAEINPROGRESS - A blocking Winsock call is in progress, or the service provider is still processing a callback function. "<<std::endl;
break;
caseWSAEADDRINUSE:
std::cout<<"WSAEADDRINUSE - Address already in use"<<std::endl;
break;
caseWSAENOTCONN:
std::cout<<"WSAENOTCONN - Socket not connected"<<std::endl;
break;
caseWSAEAFNOSUPPORT:
std::cout<<"WSAEAFNOSUPPORT - Address family not supported by protocol family"<<std::endl;
break;
caseWSAENOBUFS:
std::cout<<"WSAENOBUFS - No buffer space available. An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."<<std::endl;
std::cout<<"WSAEINVAL - One of the specified parameters was invalid such as the window handle not referring to an existing window, or the specified socket is in an invalid state. "<<std::endl;
break;
caseWSAEINPROGRESS:
std::cout<<"WSAEINPROGRESS - A blocking Winsock call is in progress, or the service provider is still processing a callback function. "<<std::endl;
break;
caseWSAENOTSOCK:
std::cout<<"WSAENOTSOCK - The descriptor is not a socket. "<<std::endl;
break;
caseWSAEADDRINUSE:
std::cout<<"WSAEADDRINUSE - Address already in use"<<std::endl;
break;
caseWSAENOTCONN:
std::cout<<"WSAENOTCONN - Socket not connected"<<std::endl;
break;
caseWSAEAFNOSUPPORT:
std::cout<<"WSAEAFNOSUPPORT - Address family not supported by protocol family"<<std::endl;
break;
caseWSAENOBUFS:
std::cout<<"WSAENOBUFS - No buffer space available. An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."<<std::endl;
std::cout<<"The socket is marked non-blocking, and the receive operation would block, or a receive timeout had been set, and the timeout expired before data were received."<<std::endl;
break;
caseEBADF:
std::cout<<"The argument socket is an invalid descriptor."<<std::endl;
break;
caseECONNRESET:
//Disconnect
_Disconnect();
std::cout<<"The connection is closed by the peer during a receive attempt on a socket."<<std::endl;
break;
caseEFAULT:
std::cout<<"The receive buffer pointer(s) point outside the process's address space."<<std::endl;
break;
caseEINTR:
std::cout<<"The receive was interrupted by delivery of a signal before any data were available."<<std::endl;
break;
caseEINVAL:
std::cout<<"MSG_OOB is set, but no out-of-band data is available."<<std::endl;
break;
caseENOBUFS:
std::cout<<"An attempt to allocate a memory buffer fails."<<std::endl;
break;
caseENOTCONN:
std::cout<<"The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2))."<<std::endl;
break;
caseENOTSOCK:
std::cout<<"The argument socket does not refer to a socket."<<std::endl;
break;
caseEOPNOTSUPP:
std::cout<<"The type and/or protocol of socket do not support the option(s) specified in flags."<<std::endl;
#else //ECHO_PLATFORM_LINUX and all other platforms
if(code!=-1)
returntrue;
switch(errno)
{
caseEAGAIN:
std::cout<<"The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received."<<std::endl;
break;
caseEBADF:
std::cout<<"The argument s is an invalid descriptor."<<std::endl;
break;
caseECONNREFUSED:
std::cout<<"A remote host refused to allow the network connection (typically because it is not running the requested service)."<<std::endl;
break;
caseEFAULT:
std::cout<<"The receive buffer pointer(s) point outside the process's address space."<<std::endl;
break;
caseEINTR:
std::cout<<"The receive was interrupted by delivery of a signal before any data were available."<<std::endl;
break;
caseEINVAL:
std::cout<<"Invalid argument passed."<<std::endl;
break;
caseENOMEM:
std::cout<<"Could not allocate memory for recvmsg()."<<std::endl;
break;
caseENOTCONN:
std::cout<<"The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2))."<<std::endl;
break;
caseENOTSOCK:
std::cout<<"The argument s does not refer to a socket."<<std::endl;
std::cout<<"WSAEINVAL - One of the specified parameters was invalid such as the window handle not referring to an existing window, or the specified socket is in an invalid state."<<std::endl;
break;
caseWSAEINPROGRESS:
std::cout<<"WSAEINPROGRESS - A blocking Winsock call is in progress, or the service provider is still processing a callback function."<<std::endl;
break;
caseWSAENOTSOCK:
std::cout<<"WSAENOTSOCK - The descriptor is not a socket."<<std::endl;
break;
caseWSAEADDRINUSE:
std::cout<<"WSAEADDRINUSE - Address already in use"<<std::endl;
break;
caseWSAENOTCONN:
std::cout<<"WSAENOTCONN - Socket not connected"<<std::endl;
break;
caseWSAEAFNOSUPPORT:
std::cout<<"WSAEAFNOSUPPORT - Address family not supported by protocol family"<<std::endl;
break;
caseWSAENOBUFS:
std::cout<<"WSAENOBUFS - No buffer space available. An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."<<std::endl;
std::cout<<"The SO_BROADCAST option is not set on the socket and a broadcast address is given as the destination."<<std::endl;
break;
caseEAGAIN:
std::cout<<"The socket is marked non-blocking and the requested operation would block."<<std::endl;
break;
caseEBADF:
std::cout<<"An invalid descriptor is specified."<<std::endl;
break;
caseECONNRESET:
std::cout<<"A connection is forcibly closed by a peer."<<std::endl;
break;
caseEFAULT:
std::cout<<"An invalid user space address is specified for a parameter."<<std::endl;
break;
caseEHOSTUNREACH:
std::cout<<"The destination address specifies an unreachable host."<<std::endl;
break;
caseEINTR:
std::cout<<"A signal interrupts the system call before any data is transmitted."<<std::endl;
break;
caseEMSGSIZE:
std::cout<<"The socket requires that message be sent atomically, and the size of the message to be sent makes this impossible. IOV_MAX."<<std::endl;
break;
caseENETDOWN:
std::cout<<"The local network interface used to reach the destination is down."<<std::endl;
break;
caseENETUNREACH:
std::cout<<"No route to the network is present."<<std::endl;
break;
caseENOBUFS:
mManager.EnableSocketWriteCheck(mSocket);
std::cout<<"Either: The system is unable to allocate an internal buffer. The operation may succeed when buffers become available."<<std::endl;
std::cout<<"OR: The output queue for a network interface is full. This generally indicates that the interface has stopped sending, but may be caused by transient congestion."<<std::endl;
break;
caseENOTSOCK:
std::cout<<"The argument socket is not a socket."<<std::endl;
break;
caseEOPNOTSUPP:
std::cout<<"socket does not support (some of) the option(s) specified in flags."<<std::endl;
break;
caseEPIPE:
std::cout<<"The socket is shut down for writing or the socket is connection-mode and is no \
longer connected. In the latter case, and if the socket is of type SOCK_STREAM, the \
SIGPIPE signal is generated to the calling thread."<<std::endl;
break;
caseEDESTADDRREQ:
std::cout<<"The socket is not connection-mode and no peer address is set."<<std::endl;
break;
caseENOTCONN:
std::cout<<"The socket is not connected or otherwise has not had the peer pre-specified."<<std::endl;
break;
default:
break;
}
returnfalse;
#else //ECHO_PLATFORM_LINUX and all other platforms (assuming default.)
if(code!=-1)
returntrue;
std::cout<<"Write error"<<std::endl;
switch(errno)
{
caseEACCES:
std::cout<<"(For Unix domain sockets, which are identified by pathname) Write permission is denied on the destination socket file, or search permission is denied for one of the directories the path prefix. (See path_resolution(2).)"<<std::endl;
_Disconnect();
break;
//case EAGAIN:
caseEWOULDBLOCK:
//This is ok, we'll just try again.
//std::cout << "The socket is marked non-blocking and the requested operation would block." << std::endl;
break;
caseEBADF:
std::cout<<"An invalid descriptor was specified."<<std::endl;
_Disconnect();
break;
caseECONNRESET:
std::cout<<"Connection reset by peer."<<std::endl;
_Disconnect();
break;
caseEDESTADDRREQ:
std::cout<<"The socket is not connection-mode, and no peer address is set."<<std::endl;
_Disconnect();
break;
caseEFAULT:
std::cout<<"An invalid user space address was specified for a parameter."<<std::endl;
_Disconnect();
break;
caseEINTR:
std::cout<<"A signal occurred before any data was transmitted."<<std::endl;
_Disconnect();
break;
caseEINVAL:
std::cout<<"Invalid argument passed."<<std::endl;
_Disconnect();
break;
caseEISCONN:
std::cout<<"The connection-mode socket was connected already but a recipient was specified. (Now either this error is returned, or the recipient specification is ignored.)"<<std::endl;
break;
caseEMSGSIZE:
std::cout<<"The socket type requires that message be sent atomically, and the size of the message to be sent made this impossible."<<std::endl;
break;
caseENOBUFS:
std::cout<<"The output queue for a network interface was full. This generally indicates that the interface has stopped sending, but may be caused by transient congestion. (Normally, this does not occur in Linux. Packets are just silently dropped when a device queue overflows.)"<<std::endl;
break;
caseENOMEM:
std::cout<<"No memory available."<<std::endl;
_Disconnect();
break;
caseENOTCONN:
std::cout<<"The socket is not connected, and no target has been given."<<std::endl;
_Disconnect();
break;
caseENOTSOCK:
std::cout<<"The argument s is not a socket."<<std::endl;
_Disconnect();
break;
caseEOPNOTSUPP:
std::cout<<"Some bit in the flags argument is inappropriate for the socket type."<<std::endl;
_Disconnect();
break;
caseEPIPE:
std::cout<<"The local end has been shut down on a connection oriented socket. In this case the process will also receive a SIGPIPE unless MSG_NOSIGNAL is set."<<std::endl;