Steps to reproduce the problem
- Start Microsoft Visual Studio .NET 2003.
- On the File menu, point to
New, and then click Project.
- Click
Visual C++ Projects under Project Types. Then, click Win32 Console Project under
Templates.
- In the Name box, type
Sample, and then click OK.
- In the Win32 Application Wizard dialog
box, click to select
the ATL and the Add Support for check boxes under Application Settings, and then
click Finish.
- In the Sample.cpp file, replace the existing default code
with the following code.
#include "stdafx.h"
#include <atlsocket.h>
void _tmain()
{
CSocketAddr aSocketAddr;
}
- In Solution Explorer, right-click the
project node, and then click Properties.
- In the project Property Pages dialog box,
click General under Configuration Properties
in the left pane. In the right pane, set the Character
Set property to Use Unicode Character Set. Click
OK.
- On the Build menu, click Build
Solution to build the application. You may notice that no compilation errors or linking
errors occur during the build process.
- On the Debug menu, click Start
Without Debugging. You may notice that you receive the error message that is described in the "Symptoms" section.
In Windows Server 2003 and in Windows XP, new Windows Sockets functions are added to the Windows Socket API.
GetAddrInfo and
FreeAddrInfo are the two new Windows Sockets functions that are added for dealing with
both Internet Protocol version 6 (IPv6) and Internet Protocol version 4 (IPv4)
addresses. The Active Template Library (ATL) 7.1
CSocketAddr class uses these new Windows Socket functions to provide support
for IPv6. Other ATL and Microsoft Foundation Classes (MFC) classes also use the
CSocketAddr class to provide IPv6 support. For example, the
CAsyncSocket class and the
CSMTPConnection class use the
CSocketAddr class.
Note The
CAsyncSocket class is an MFC class. The
CSMTPConnection class is an ATL class.
The problem that is described in the "Symptoms"
section occurs in any Unicode-enabled application that uses the
FreeAddrInfo Windows Socket function on a computer that is running Windows Server 2003 or Windows XP. Because the ATL
CSocketAddr class uses the
FreeAddrInfo function, the same problem also occurs in ATL 7.1. Any
class in ATL 7.1 and MFC 7.1 that uses the
CSocketAddr class to enable IPv6 support reflects this behavior. For example, the
CAsyncSocket class and the
CSMTPConnection class use the
CSocketAddr class.
ATL server classes such as
CAtlHttpClient and
CSoapSocketClientT use the
ZEvtSyncSocket class, and display the same error. This behavior occurs because the
ZEvtSyncSocket internal class uses the
CSocketAddr class in its implementation.
Note The
CAtlHttpClient class provides HTTP client support. The
CSoapSocketClientT class provides XML Web services client support.