Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
MFC
Classes
CAsyncSocket Class
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
MFC Library Reference 
CAsyncSocket Class 

Represents a Windows Socket — an endpoint of network communication.

class CAsyncSocket : public CObject

Class CAsyncSocket encapsulates the Windows Socket Functions API, providing an object-oriented abstraction for programmers who want to use Windows Sockets in conjunction with MFC.

This class is based on the assumption that you understand network communications. You are responsible for handling blocking, byte-order differences, and conversions between Unicode and multibyte character set (MBCS) strings. If you want a more convenient interface that manages these issues for you, see class CSocket.

To use a CAsyncSocket object, call its constructor, then call the Create function to create the underlying socket handle (type SOCKET), except on accepted sockets. For a server socket call the Listen member function, and for a client socket call the Connect member function. The server socket should call the Accept function upon receiving a connection request. Use the remaining CAsyncSocket functions to carry out communications between sockets. Upon completion, destroy the CAsyncSocket object if it was created on the heap; the destructor automatically calls the Close function. The SOCKET data type is described in the article Windows Sockets: Background.

For more information, see Windows Sockets: Using Class CAsyncSocket and related articles., as well as Windows Sockets 2 API.

Header: afxsock.h

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker