Created
July 13, 2013 07:49
-
-
Save wcypierre/5989871 to your computer and use it in GitHub Desktop.
[Posix UDP] What to consider when coding for the multithreaded udp server with thread pool
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. The socket's file descriptor must be global(if you wanted to share the socket) | |
2. You must pass the sizeof the destination length(sizeof(client_addr)) into the thread in pthread_create as if you do not then you won't get a correct result as the client_addr is a pointer to sockaddr_in instead of sockaddr_in, so the return value of sizeof() won't be the one that we wanted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment