Is there something in C++ that allows the main() program to sleep and only wakeup if there is data on the scoket ?
I work on VMS using ANSI C++. In the old days I would write a C program with a main() containing a SYS$HIBER() call which bascially allows the main to hibernate until a sys$wake() call is made.
I would write TCP/IP routines using QIO, and when data arrived on the socket, an AST would fire and call sys$wake() to wake the main program. The problem is - this style of programming will only work on VMS.
I'm trying to write a new program in C++ that runs on VMS but is more portable. What can I use to allow the main program to sleep whilst there is nothing to do, and what can I use on the socket side to notify main() it has data to process ? Remember I work on a VMS platform so only ANSI C++ stuff may be used.
Thanks in advance for your help
I know that would work, but I must admit it's my fault for not being clear !!
My main program is both a client and server, which is why I cannot have blocking reads. The main program must be free to process commands at all times, it cannot block on reads or write !