gtpc1m4f | Transmission Control Protocol/Internet Protocol |
The sock_errno function returns the error code set by a socket call.
Format
#include <socket.h> int sock_errno(void);
Normal Return
A nonnegative error code is returned.
Error Return
None.
Programming Considerations
None.
Examples
The following example prints out the socket error number if an error occurs in the socket function.
#include <socket.h>
·
·
·
int rc; int server_sock;
·
·
·
server_sock = socket(AF_INET, SOCK_STREAM, 0); if (server_sock == -1) { printf("Error in socket - %d\n",sock_errno()); exit(0); }
Related Information