Created
November 8, 2010 15:06
-
-
Save hintjens/667779 to your computer and use it in GitHub Desktop.
Exhaust file handles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Exhaust file handles per process | |
| #include "zmq.h" | |
| #include "stdio.h" | |
| int main () | |
| { | |
| void *context = zmq_init (1); | |
| int socket_nbr; | |
| for (socket_nbr = 0; socket_nbr < 8000000; socket_nbr++) { | |
| void *socket = zmq_socket (context, ZMQ_REQ); | |
| if (!socket) | |
| break; | |
| } | |
| printf ("This system allows up to %d sockets\n", socket_nbr); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment