Created
May 28, 2021 06:05
-
-
Save uhmseohun/f8ef59504b2e7a24c80f15e64e869d71 to your computer and use it in GitHub Desktop.
socket_select_function
This file contains 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
socket1 = Socket() | |
socket2 = Socket() | |
FD_ZERO(&read); | |
while (1) { | |
FD_SET(socket1, &read); | |
FD_SET(socket2, &read); | |
state = select(maxfd+1, &read, 0, 0, 0); | |
switch (state) { | |
case -1: | |
break; | |
case 0: | |
break; | |
default: | |
if(FD_ISSET(socket1, &read)) { | |
} | |
if (FD_ISSET(socket2, &read)) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment