851 |
} |
} |
852 |
#else |
#else |
853 |
if (result == -1) { |
if (result == -1) { |
|
if (errno == EAGAIN) //Would block, try again later. |
|
|
return false; |
|
854 |
switch(errno) { |
switch(errno) { |
855 |
case EBADF: |
case EBADF: |
856 |
dmsg(2,("LSCPScanner: The argument s is an invalid descriptor.\n")); |
dmsg(2,("LSCPScanner: The argument s is an invalid descriptor.\n")); |
857 |
return false; |
break; // close connection |
858 |
case ECONNREFUSED: |
case ECONNREFUSED: |
859 |
dmsg(2,("LSCPScanner: A remote host refused to allow the network connection (typically because it is not running the requested service).\n")); |
dmsg(2,("LSCPScanner: A remote host refused to allow the network connection (typically because it is not running the requested service).\n")); |
860 |
return false; |
break; // close connection |
861 |
case ENOTCONN: |
case ENOTCONN: |
862 |
dmsg(2,("LSCPScanner: The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)).\n")); |
dmsg(2,("LSCPScanner: The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)).\n")); |
863 |
return false; |
break; // close connection |
864 |
case ENOTSOCK: |
case ENOTSOCK: |
865 |
dmsg(2,("LSCPScanner: The argument s does not refer to a socket.\n")); |
dmsg(2,("LSCPScanner: The argument s does not refer to a socket.\n")); |
866 |
return false; |
break; // close connection |
867 |
case EAGAIN: |
case EAGAIN: |
868 |
dmsg(2,("LSCPScanner: 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.\n")); |
dmsg(2,("LSCPScanner: 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.\n")); |
869 |
return false; |
return false; // don't close connection, try again later |
870 |
case EINTR: |
case EINTR: |
871 |
dmsg(2,("LSCPScanner: The receive was interrupted by delivery of a signal before any data were available.\n")); |
dmsg(2,("LSCPScanner: The receive was interrupted by delivery of a signal before any data were available.\n")); |
872 |
return false; |
break; // close connection |
873 |
case EFAULT: |
case EFAULT: |
874 |
dmsg(2,("LSCPScanner: The receive buffer pointer(s) point outside the process's address space.\n")); |
dmsg(2,("LSCPScanner: The receive buffer pointer(s) point outside the process's address space.\n")); |
875 |
return false; |
break; // close connection |
876 |
case EINVAL: |
case EINVAL: |
877 |
dmsg(2,("LSCPScanner: Invalid argument passed.\n")); |
dmsg(2,("LSCPScanner: Invalid argument passed.\n")); |
878 |
return false; |
break; // close connection |
879 |
case ENOMEM: |
case ENOMEM: |
880 |
dmsg(2,("LSCPScanner: Could not allocate memory for recvmsg.\n")); |
dmsg(2,("LSCPScanner: Could not allocate memory for recvmsg.\n")); |
881 |
return false; |
break; // close connection |
882 |
default: |
default: |
883 |
dmsg(2,("LSCPScanner: Unknown recv() error.\n")); |
dmsg(2,("LSCPScanner: Unknown recv() error.\n")); |
884 |
return false; |
break; // close connection |
885 |
} |
} |
886 |
CloseConnection(iter); |
CloseConnection(iter); |
887 |
return false; |
return false; |