diff --git a/examples/templates/posix_sockets.h b/examples/templates/posix_sockets.h index 6149423..f469d65 100644 --- a/examples/templates/posix_sockets.h +++ b/examples/templates/posix_sockets.h @@ -7,6 +7,9 @@ #include #include #endif +#if defined(__VMS) +#include +#endif #include /* @@ -55,6 +58,15 @@ int open_nb_socket(const char* addr, const char* port) { ioctlsocket(sockfd, FIONBIO, &iMode); } #endif +#if defined(__VMS) + /* + OpenVMS only partially implements fcntl. It works on file descriptors + but silently fails on socket descriptors. So we need to fall back on + to the older ioctl system to set non-blocking IO + */ + int on = 1; + if (sockfd != -1) ioctl(sockfd, FIONBIO, &on); +#endif /* return the new socket fd */ return sockfd;