Click here to Skip to main content
11,716,249 members (84,582 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C Visual-Studio Events socket , +
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
Edited 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
0 Sergey Alexandrovich Kryukov 599
1 Richard MacCutchan 280
2 Maciej Los 275
3 OriginalGriff 160
4 F-ES Sitecore 145
0 Sergey Alexandrovich Kryukov 1,003
1 Richard MacCutchan 430
2 CHill60 415
3 Maciej Los 399
4 OriginalGriff 385


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2015
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