Skip to content

Instantly share code, notes, and snippets.

@kkumar-fk
Last active July 23, 2019 04:31
Show Gist options
  • Save kkumar-fk/ad4abdd60c0b5c9295b61b1d64b16b9a to your computer and use it in GitHub Desktop.
Save kkumar-fk/ad4abdd60c0b5c9295b61b1d64b16b9a to your computer and use it in GitHub Desktop.
server.sin_family = AF_INET;
server.sin_port = htons(SERVER_PORT);
bcopy(server_ent->h_addr, &server.sin_addr.s_addr, server_ent->h_length);
/* Connect to server, and set the socket's destination IP address and port#
* based on above parameters. Also, request the kernel to automatically set
* the Source IP and port# if the application did not call bind() prior to connect().
*/
connect(fd, (struct sockaddr *)&server, sizeof server);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment