WSASetIPUserMtu function (ws2tcpip.h)

Sets the user-defined IP layer MTU on a socket.

Syntax

INT WSASetIPUserMtu(
  [in] SOCKET Socket,
  [in] DWORD  Mtu
);

Parameters

[in] Socket

A descriptor that identifies a socket.

[in] Mtu

Type: DWORD

The user-defined IP layer MTU to be set on the socket.

Return value

On success, the function returns 0. Otherwise, a value of SOCKET_ERROR is returned, and you can retrieve a specific error code by calling WSAGetLastError.

Remarks

This functionality is supported through the IP_USER_MTU socket option. WSASetIPUserMtu is a type-safe wrapper for setting this socket option, and we recommend it over setsockopt.

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004 (10.0; Build 19041)
Minimum supported server Windows Server, version 2004 (10.0; Build 19041)
Target Platform Windows
Header ws2tcpip.h
Library Ws2_32.lib
DLL Ws2_32.dll