Reputation: 1829
I am writing client in c++ (socket programming) but the server has two options to send to client request and also server can send data on specific port(lets say port ZZ). I want the client listening on port ZZ non-blocking. How can I do it? Would select() command will help me? or is there any other technique to implement this. Thanks
Upvotes: 0
Views: 394
Reputation: 144
Maybe use multithread is a better choice. You can use recive reponse tin the main thread and listen the port ZZ in another thread.
Upvotes: 0
Reputation: 2991
You can use either the non blocking mode or you use a very small block time (like one millisecond).
To active non blocking mode you have to configure your socket alike.
See Beejs Guide to socket Programming to learn how to do it.
Upvotes: 1