Click here to Skip to main content
13,045,984 members (47,628 online)
Rate this:
 
Please Sign up or sign in to vote.
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 14-Sep-12 7:50am
Updated 14-Sep-12 7:51am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

The first thing you really need is this[^]

Then you can go on to read this[^] that might be able to help you.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100