Networking services sockets is based on the Berkeley Software Distribution version 4.4 sockets implementation.
The IBM OS/2 socket implementation differs from the Berkeley socket implementation as follows:
This is intended to obtain per-thread error codes in a multithreaded application environment and to avoid conflict with standard ANSI C error constants.
BSD-style error checking is as follows:
rt = recv(s, buf, sizeof(buf), 0);
if (rt == -1 && errno == EWOULDBLOCK)
{...}
if (recv(s, buf, sizeof(buf), 0) < 0) {
perror("Recv()");
exit(1);
}
rt = recv(s, buf, sizeof(buf), 0);
if (rt == -1 && sock_errno() == SOCEWOULDBLOCK)
{...}
if (recv(s, buf, sizeof(buf), 0) < 0)
{
psock_errno("Recv()");
exit(1);
}