Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I was trying to make a socket program,in which i was able to connect to server and send message but the part that i would was not able to do is:-
Make an event which will be set if something is written on the socket through which i have connected to the socket and when the event i have to make the recv() call.
And if i didn't get any response from the server i should make the send call again after 5 second.
How can it be done.
Please suggest
Posted
Updated 14-Sep-12 7:51am
v2

The first thing you really need is this[^]

Then you can go on to read this[^] that might be able to help you.
 
Share this answer
 
Use select() on a separate thread to wait for data (you can also set a timeout value).
Then call recv() to read the data. If timeout occurs, (re)send data to your server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900