Skip to content

Instantly share code, notes, and snippets.

@flgr
Created July 2, 2013 12:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save flgr/5909055 to your computer and use it in GitHub Desktop.
Save flgr/5909055 to your computer and use it in GitHub Desktop.
Program which creates a half-open socketpair, then sits around endlessly, doing nothing
#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv) {
int sp[2];
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) {
perror("Failed to get socketpair");
}
close(sp[1]);
for (;;) { sleep(1000); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment