Last active
March 15, 2018 02:22
-
-
Save cwilhit/a82f786770839a9f3e8e31e93ff2f84e to your computer and use it in GitHub Desktop.
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
// Create a server AF_UNIX socket | |
#define SERVER_ADDRESS “c:\unix\server.sock” | |
SOCKADDR_UN ServerAddress = {0}; | |
Server = socket(AF_UNIX, SOCK_STREAM, 0); | |
// Bind the socket to a path. | |
ServerAddress.sun_family = AF_UNIX; | |
strcpy(ServerAddress.sun_path, SERVER_ADDRESS); | |
bind(Server, &ServerAddress, sizeof(ServerAddress)); | |
// Accept a connection. | |
listen(Server, 5); | |
Accepted = accept(Server, ….); | |
// Send and receive data on the accepted socket. | |
// Shutdown and close the connection. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment