It has been a long time since I did socket programming. What I do remember was that the listening socket would lock the entire thread. The solution is to run it in a second thread. You might want to do some web searches on threading (pthread).
That’s definitely one option (the better one IMO).
Another option is to set the socket to non-blocking (one of: FNDELAY/O_NDELAY/O_NONBLOCK/FIONBIO) and then be prepared for most any net call to return “would block” (EWOULDBLOCK, EAGAIN, etc.) And if you’re doing I/O to multiple connections in one thread, you’ll find you probably want this anyway, regardless whether it’s the GL thread or not.