Mfcsocs.exe sample demonstrates how to communicate in a TCP connection in Visual C++
Article ID: 185728
Article Last Modified on 11/21/2006
APPLIES TO
- Microsoft Foundation Class Library 4.2, when used with:
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
- Microsoft Visual C++ .NET 2002 Standard Edition
- Microsoft Visual C++ .NET 2003 Standard Edition
This article was previously published under Q185728
NOTE: Microsoft Visual C++ .NET (2002) and Microsoft Visual C++ .NET
(2003) support both the managed code model that is provided by the .NET
Framework and the unmanaged native Windows code model. The information in this
article applies to unmanaged Visual C++ code only.
SUMMARY
The MFCSocs sample is a minimal MFC application that
demonstrates how to use the CSocket and CAsyncSocket classes to communicate in
a Transmission Control Protocol (TCP) connection. This sample is a dialog-based
application. Depending on the selection in the user interface, the application
can run either as a TCP server that listens on a certain TCP port, or as a
client that connects to a server on the same TCP port.
When running
as a client, the application uses the CSocket class to communicate with the
server. When running as a server, the application uses CAsyncSocket to listen
to connection requests and communicate with the client after the connection is
established.
Keywords: kbinfo kbapi kbfile kbhowto kbnetwork kbsample kbwinsock KB185728