Click here to Skip to main content
15,795,942 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTCP/IP Socket connectivity issue in Internet Pin
manoharbalu19-Jun-18 2:44
manoharbalu19-Jun-18 2:44 
AnswerRe: TCP/IP Socket connectivity issue in Internet Pin
Jochen Arndt19-Jun-18 3:52
professionalJochen Arndt19-Jun-18 3:52 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
manoharbalu19-Jun-18 4:44
manoharbalu19-Jun-18 4:44 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
Jochen Arndt19-Jun-18 5:33
professionalJochen Arndt19-Jun-18 5:33 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
manoharbalu20-Jun-18 20:02
manoharbalu20-Jun-18 20:02 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
Jochen Arndt20-Jun-18 22:04
professionalJochen Arndt20-Jun-18 22:04 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
manoharbalu21-Jun-18 1:55
manoharbalu21-Jun-18 1:55 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
Jochen Arndt21-Jun-18 2:31
professionalJochen Arndt21-Jun-18 2:31 
It depends on the used socket implementation (raw / POSIX sockets, WinSock, CSocket, or CAsyncSocket Class[^]).

With raw sockets, use the select function (Windows)[^] passing the timeout.

With blocking receive calls, you can set the SO_RCVTIMEO socket option (see setsockopt function (Windows)[^]).

When using CAsyncSocket, you have to implement your own timer that is reset when data are received.

With non-blocking calls you usually wait for events with WaitFor(Single|Multiple)Object(s) which have a timeout parameter. I recommend this when using a worker thread for receiving because the call can also catch a terminate event to stop the thread when closing the connection by intention like when terminating the application.

Once a timeout is detected you close the related connections / sockets like when terminating the application. Afterwards enter the listen state again on the server and try to (re-)connect on the client like when starting the applications.

A complete example - even when knowing the used socket type - would be far too much for this forum. But there are a lot of tutorials in the net and here at CP about the topic.
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
manoharbalu21-Jun-18 20:36
manoharbalu21-Jun-18 20:36 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
Victor Nijegorodov21-Jun-18 21:35
Victor Nijegorodov21-Jun-18 21:35 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
Jochen Arndt21-Jun-18 21:55
professionalJochen Arndt21-Jun-18 21:55 
GeneralRe: TCP/IP Socket connectivity issue in Internet Pin
manoharbalu25-Jun-18 20:04
manoharbalu25-Jun-18 20:04 
AnswerRe: TCP/IP Socket connectivity issue in Internet Pin
jschell23-Jun-18 5:52
jschell23-Jun-18 5:52 
Questioninstalled apps Pin
john563217-Jun-18 21:22
john563217-Jun-18 21:22 
AnswerRe: installed apps Pin
Victor Nijegorodov17-Jun-18 21:45
Victor Nijegorodov17-Jun-18 21:45 
GeneralRe: installed apps Pin
john563217-Jun-18 21:53
john563217-Jun-18 21:53 
AnswerRe: installed apps Pin
User 742933817-Jun-18 22:33
professionalUser 742933817-Jun-18 22:33 
GeneralRe: installed apps Pin
john563217-Jun-18 23:58
john563217-Jun-18 23:58 
AnswerRe: installed apps Pin
User 742933818-Jun-18 0:04
professionalUser 742933818-Jun-18 0:04 
QuestionChange Tabs in Ribbon Control dynamically - C++ Pin
Gopi Nath14-Jun-18 3:13
Gopi Nath14-Jun-18 3:13 
AnswerRe: Change Tabs in Ribbon Control dynamically - C++ Pin
User 742933818-Jun-18 0:37
professionalUser 742933818-Jun-18 0:37 
GeneralRe: Change Tabs in Ribbon Control dynamically - C++ Pin
Gopi Nath18-Jun-18 2:25
Gopi Nath18-Jun-18 2:25 
AnswerRe: Change Tabs in Ribbon Control dynamically - C++ Pin
User 742933818-Jun-18 2:28
professionalUser 742933818-Jun-18 2:28 
GeneralRe: Change Tabs in Ribbon Control dynamically - C++ Pin
Gopi Nath18-Jun-18 2:42
Gopi Nath18-Jun-18 2:42 
GeneralRe: Change Tabs in Ribbon Control dynamically - C++ Pin
Richard Andrew x6420-Jun-18 15:23
professionalRichard Andrew x6420-Jun-18 15:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.