Skip to content

Instantly share code, notes, and snippets.

@cwilhit
Created February 5, 2018 22:20
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 cwilhit/68205c246455993ae8208d6359fe2244 to your computer and use it in GitHub Desktop.
Save cwilhit/68205c246455993ae8208d6359fe2244 to your computer and use it in GitHub Desktop.
// Create a client AF_UNIX socket
#define SERVER_ADDRESS “/mnt/c/unix/server.sock”
SOCKADDR_UN ServerAddress = {0};
Client = socket(AF_UNIX, SOCK_STREAM, 0);
// Bind the socket to a path.
ServerAddress.sun_family = AF_UNIX;
strcpy(ServerAddress.sun_path, SERVER_ADDRESS);
connect(Client, &ServerAddress, sizeof(ServerAddress));
// Send and receive data on the connection.
// Shutdown and close the connection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment