Click here to Skip to main content
       

ATL / WTL / STL

 
QuestionHow to get used dll's path information programetically? Pinmemberlitu kumar6-Nov-12 19:38 
AnswerRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan6-Nov-12 21:40 
GeneralRe: How to get used dll's path information programetically? [modified] Pinmemberlitu kumar6-Nov-12 23:27 
GeneralRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan7-Nov-12 4:54 
GeneralRe: How to get used dll's path information programetically? Pinmemberlitu kumar7-Nov-12 17:11 
GeneralRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan7-Nov-12 21:34 
GeneralRe: How to get used dll's path information programetically? Pinmemberlitu kumar7-Nov-12 22:35 
GeneralRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan8-Nov-12 0:16 
GeneralRe: How to get used dll's path information programetically? [modified] Pinmemberlitu kumar8-Nov-12 2:58 
GeneralRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan8-Nov-12 4:03 
GeneralRe: How to get used dll's path information programetically? Pinmemberlitu kumar15-Nov-12 19:53 
GeneralRe: How to get used dll's path information programetically? PinmvpRichard MacCutchan15-Nov-12 23:50 
AnswerRe: How to get used dll's path information programetically? Pinmemberhacker240union22-Nov-12 23:41 
Questiondetect close event with CAsyncSocket [modified] Pinmemberbkelly135-Nov-12 10:32 
Environment: Windows 7, Visual Studio 2008, C++ MFC
 
Question:
How does class AsyncSocket for the server side detect and notify the application when the client closes the connection?
 
Details:
I wrote the async article found here: Asynchronous TCP Part 1 as a learning tool. Now that I am using that knowledge in a working project I find that when the client closes the socket, I don’t see any results on the server side. I was expecting that OnClose() would be called, but that does not happen. On the client side, after closing, no data can be received until it is Initialized and connected again.
The problem is that in the real application, when the client closes and re-connects the interface protocol for the client requires that the server send some specific information. I am not seeing a way to detect that closure.
 
Edit: OnClose is declared public. That was an answer in another thread.
And again: I do not have the client code and have no control over the client side behavior.
and again: continued searching yielded something about the read() method getting a result or error. This server application never receives any data from the client and uses no reads. Do I still need to post a read to get a close status?
 
POSSIBLE ANSWER
My application uses C_Server, decended from CAsyncSocket, to post the Listen and call Accept(). In the call to Accept it creates an object from C_Server_Send to communicate with the client. When I add code to post a receive from C_Server_Send, and then close the client, OnClose() from C_Server_Send gets called. So, empirically, I conclude that Yes, I must post a receive to enable detection of client disconnect. Is that correct?
 
NEW PROBLEM:
How is C_Server_Send to be deleted.
First: C_Server_Send was newed from C_Server, but that object can create an indefiniate number of C_Server_Send objects as multiple clients connect. Must it keep track of each one.
Second: How does C_Server know that its time to delete an arbitrary instance of C_Server_Send?
Thanks for your time


modified 6-Nov-12 12:54pm.

QuestionIntermediate GUI Techniques Pinmemberbkelly132-Nov-12 3:21 
AnswerRe: Intermediate GUI Techniques PinmvpRichard MacCutchan2-Nov-12 6:20 
Questionproblem with sprintf_s() on win 7 PinmemberMember 93537761-Nov-12 21:34 
AnswerRe: problem with sprintf_s() on win 7 PinmvpRichard MacCutchan1-Nov-12 22:50 
GeneralRe: problem with sprintf_s() on win 7 Pinmemberbkelly132-Nov-12 3:16 
GeneralRe: problem with sprintf_s() on win 7 PinmvpRichard MacCutchan2-Nov-12 6:15 
GeneralRe: problem with sprintf_s() on win 7 PinmemberMember 93537764-Nov-12 16:34 
GeneralRe: problem with sprintf_s() on win 7 PinmvpRichard MacCutchan4-Nov-12 21:26 
AnswerRe: problem with sprintf_s() on win 7 PinmemberH.Brydon26-Nov-12 19:36 
Questionwsageterror() Pinmemberbkelly131-Nov-12 15:28 
AnswerRe: wsageterror() PinmvpRichard MacCutchan1-Nov-12 22:48 
QuestionSTL map issue in VS2010 PinmemberSubhash Madhukar30-Oct-12 3:47 
AnswerRe: STL map issue in VS2010 PinmvpRichard MacCutchan30-Oct-12 6:04 
Questionhow do i copy a CImage DIB to clipboard PinmemberMember 951640015-Oct-12 11:15 
AnswerRe: how do i copy a CImage DIB to clipboard PinmemberAndrew Cherednik15-Oct-12 11:41 
QuestionWhy does this fail - CFile / SeekToEnd? [modified] Pinmembercharlieg10-Oct-12 6:43 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg10-Oct-12 9:31 
AnswerRe: Why does this fail - CFile / SeekToEnd? PinmemberAndrew Cherednik10-Oct-12 11:23 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg11-Oct-12 2:20 
AnswerRe: Why does this fail - CFile / SeekToEnd? PinmvpRichard MacCutchan10-Oct-12 21:45 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg11-Oct-12 2:30 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg11-Oct-12 4:53 
GeneralRe: Why does this fail - CFile / SeekToEnd? PinmvpRichard MacCutchan11-Oct-12 11:19 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg11-Oct-12 11:34 
GeneralRe: Why does this fail - CFile / SeekToEnd? PinmvpRichard MacCutchan11-Oct-12 12:01 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg12-Oct-12 5:54 
AnswerRe: Why does this fail - CFile / SeekToEnd? PinmemberStephen Hewitt11-Oct-12 12:58 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pinmembercharlieg18-Jan-13 1:47 
QuestionKeep program open and running PinmemberLucidation8-Oct-12 11:23 
AnswerRe: Keep program open and running PinmvpRichard MacCutchan8-Oct-12 22:14 
GeneralRe: Keep program open and running PinmemberLucidation9-Oct-12 11:14 
GeneralRe: Keep program open and running PinmvpRichard MacCutchan9-Oct-12 11:19 
AnswerRe: Keep program open and running PinmemberStephen Hewitt11-Oct-12 21:45 
QuestionUSBView Compile Error PinmemberJim Fell5-Oct-12 10:17 
AnswerRe: USBView Compile Error PinmemberWes Aday5-Oct-12 10:33 
GeneralRe: USBView Compile Error PinmemberJim Fell10-Oct-12 8:04 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 26 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid