Click here to Skip to main content
15,860,844 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: get a number into static text control Pin
Richard MacCutchan13-Sep-12 21:52
mveRichard MacCutchan13-Sep-12 21:52 
GeneralRe: get a number into static text control Pin
bkelly1314-Sep-12 15:00
bkelly1314-Sep-12 15:00 
GeneralRe: get a number into static text control Pin
Paul M Watt14-Sep-12 15:36
mentorPaul M Watt14-Sep-12 15:36 
GeneralRe: get a number into static text control Pin
Richard MacCutchan14-Sep-12 23:02
mveRichard MacCutchan14-Sep-12 23:02 
GeneralRe: get a number into static text control Pin
bkelly1315-Sep-12 5:14
bkelly1315-Sep-12 5:14 
GeneralRe: get a number into static text control Pin
Richard MacCutchan15-Sep-12 5:42
mveRichard MacCutchan15-Sep-12 5:42 
QuestionMirroring system imagelist Pin
Huzifa Terkawi11-Sep-12 15:27
Huzifa Terkawi11-Sep-12 15:27 
QuestionCAsyncSocket, first application Pin
bkelly139-Sep-12 5:26
bkelly139-Sep-12 5:26 
Environment: Windows 7, Visual Studio 2008, MFC, CPP

Two questions:
1. How does the asynchronous notification get back into the program?
2. What is the purpose of the class MyEchoSocket?

Details
I am working my way through the tutorial socket Programming with MFC (Part 1), written by Jobin Wilson and found on this website here:
Socket Programming with MFC (Part 1)

I am good through the point where the server calls the Listen() method. There is no client at this time and the code paused for a second or so then continues. My server class has the base class: CAsyncSocket so I presume the OS will eventually send a notification as to when a client connects. What part of the code says to the OS, when the client connects, call function X?

The next operation is to call the Accept( <argument uncertain=""> ) method. Under topic Accepting Connections Wilson suddenly uses m_sConnected as the argument to Accept without explanation. Looking at the downloaded code I think this is an instance of his class MyEchoSocket. But all he does with that class is call methods from the base class CAsyncSocket. Why not just call the CAsyncSocket methods directly?


Edit: The link did not work for me. Try again. I think it is Ok now.

Edit 14 Sep 2012
I think I am beginning to understand.
For question 1:
The programmer must override a set of methods from the base class. These include OnAccept(), OnConnect(), OnReceive(), etc. Windows calls these methods when the event has happened.

For question 2:
When the server code runs, it initiates a listen activity, Windows is listening for a client to connect. When one does, skipping some stuff, an instance of the class written to handle the traffic is created and put into action. That would be an instance of the MyEchoSocket. That class then performs all the sends and receives with the client. Meanwhile, the original server object is fee to go back to listening for another client connect.

No one has posted a reply and this is what I think is supposed to happen. I am still working my code. Please jump in if you have any corrections or comments.
Thanks for your time


modified 14-Sep-12 22:00pm.

AnswerRe: CAsyncSocket, first application Pin
Paul M Watt14-Sep-12 15:47
mentorPaul M Watt14-Sep-12 15:47 
QuestionAfxGetThread vs GetCurrentThreadID Pin
kishorekumarnaik6-Sep-12 6:52
kishorekumarnaik6-Sep-12 6:52 
AnswerRe: AfxGetThread vs GetCurrentThreadID Pin
Jiří Miklík7-Sep-12 0:24
Jiří Miklík7-Sep-12 0:24 
Questionerror C2039: 'abort' : is not a member of 'std' Pin
KASR12-Sep-12 23:35
KASR12-Sep-12 23:35 
AnswerRe: error C2039: 'abort' : is not a member of 'std' Pin
Richard MacCutchan3-Sep-12 0:50
mveRichard MacCutchan3-Sep-12 0:50 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
KASR13-Sep-12 1:44
KASR13-Sep-12 1:44 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
Richard MacCutchan3-Sep-12 2:21
mveRichard MacCutchan3-Sep-12 2:21 
AnswerRe: error C2039: 'abort' : is not a member of 'std' Pin
Stephen Hewitt3-Sep-12 16:54
Stephen Hewitt3-Sep-12 16:54 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
KASR13-Sep-12 19:46
KASR13-Sep-12 19:46 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
Richard MacCutchan3-Sep-12 22:18
mveRichard MacCutchan3-Sep-12 22:18 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
KASR13-Sep-12 22:29
KASR13-Sep-12 22:29 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
Richard MacCutchan3-Sep-12 23:23
mveRichard MacCutchan3-Sep-12 23:23 
GeneralRe: error C2039: 'abort' : is not a member of 'std' Pin
KASR14-Sep-12 2:36
KASR14-Sep-12 2:36 
GeneralHow to print file inclusion stack in VC6 Pin
KASR16-Aug-12 23:43
KASR16-Aug-12 23:43 
Questionc++ and directshow Pin
mexmerou4-Aug-12 0:04
mexmerou4-Aug-12 0:04 
AnswerRe: c++ and directshow Pin
Richard MacCutchan4-Aug-12 1:29
mveRichard MacCutchan4-Aug-12 1:29 
AnswerRe: c++ and directshow Pin
barneyman7-Aug-12 19:52
barneyman7-Aug-12 19:52 

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.