Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

WSASetLastError function

The WSASetLastError function sets the error code that can be retrieved through the WSAGetLastError function.

Syntax


void WSASetLastError(
  _In_  int iError
);

Parameters

iError [in]

Integer that specifies the error code to be returned by a subsequent WSAGetLastError call.

Return value

This function generates no return values.

Error codeMeaning
WSANOTINITIALISED

A successful WSAStartup call must occur before using this function.

 

Remarks

The WSASetLastError function allows an application to set the error code to be returned by a subsequent WSAGetLastError call for the current thread. Note that any subsequent Windows Sockets routine called by the application will override the error code as set by this routine.

The error code set by WSASetLastError is different from the error code reset by calling the function getsockopt with SO_ERROR.

The Windows Sockets error codes used by this function are listed under Windows Sockets Error Codes.

Windows Phone 8: This API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winsock2.h

Library

Ws2_32.lib

DLL

Ws2_32.dll

See also

Windows Sockets Error Codes
Winsock Reference
Winsock Functions
getsockopt
WSAGetLastError

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.