Skip to content

Instantly share code, notes, and snippets.

@pgte
Created September 15, 2010 12:11
Show Gist options
  • Save pgte/580645 to your computer and use it in GitHub Desktop.
Save pgte/580645 to your computer and use it in GitHub Desktop.
/* create socket */
serverSocket = socket(...);
/* bind the socket to an address and port */
bind(serverSocket, ...);
/* socket will listen for incoming connections */
listen(serverSocket, ...);
for(;;) {
/* Wait for client connections */
clientSocket = accept(serverSocket, ...);
/* do something with it */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment