Aqeel Raza
Aqeel Raza

Reputation: 1829

c++ client with response on different port

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

Answers (2)

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

Quonux
Quonux

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

Related Questions