Solved

Help For CAsyncSockt..?

Posted on 1998-06-16
2
163 Views
Last Modified: 2013-11-20
Anybody can tell you how to use CAsyncSockt in Non-Blocking mode..? If Possible any sample code also..The doubt is how to use the notification messages.

Thanx In Advance
Sanesh
0
Comment
Question by:sanesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 1317997
It's pretty simple:

1) Derive your own class from CAsyncSocket, say myAsyncSocket so that you can override the OnXXX functions to receive the notification messages. Do this by using the ClassWizard, Add new class dialog.  Be sure to select CAsyncSocket as the base class.

2) Add an instance of myAsyncsocket to your application.

3) Using the ClassWizard in VC++, add the message maps for the notifications you want to receive.

4) Implement your OnXXX functions.  It seems the biggest confusion is about OnSend.  It notifies that it is OK to send data, NOT that the data has been sent.

0
 
LVL 32

Expert Comment

by:jhance
ID: 1317998
Oops, I forgot to include:

Call IOCtl(FIONBIO, &dwNoblock); (with dwNoblock a DWORD != 0)
to make the socket non-blocking, then call

AsyncSelect() to enable the notifications you want to receive.  

Remember to set the lEvent paramter in Create to 0 so that you can call IOCtl on the object.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 110
viewing source code from eclipse 13 111
bigDiff challenge 17 144
Problem to open Excel file 15 266
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question