Solved

Help For CAsyncSockt..?

Posted on 1998-06-16
2
164 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

617 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