Created
July 24, 2019 02:56
-
-
Save kkumar-fk/d830c6c3c81d22154b327570133fc161 to your computer and use it in GitHub Desktop.
Typical server program
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
1. Create a socket: | |
server_fd = socket(...); | |
2. Bind to a well known IP address and port#: | |
ret = bind(server_fd, ...); | |
3. Mark the socket as passive by changing it's state to LISTEN: | |
ret = listen(server_fd, ...); | |
4. Wait for a client to connect, and get a reference file descriptor: | |
client_fd = accept(server_fd, ...); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment