Skip to main content

IpGetSocketName

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

  • long IpGetSocketName( dword socket, dword &ipv4Address, dword &port); // form 1
  • long IpGetSocketName( dword socket, byte ipv6Address[], dword &port); // form 2
  • long IpGetSocketName( dword socket, IP_Endpoint localEndpoint ); // form 3

Method Syntax

  • socket.GetSocketName(dword &ipv4Address, dword &port); // form 1
  • socket.GetSocketName(byte ipv6Address[], dword &port); // form 2
  • socket.GetSocketName(IP_Endpoint localEndpoint); // form 3

Description

The function returns the local bound address and port of a socket.

Parameters

  • socket: The socket handle.
  • ipv4Address: The numerical IPv4 address is returned in this variable.
  • Ipv6Address: A 16 byte array to return the IPv6 address.
  • port: The local bound port.
  • localEndpoint: IP_Endpoint variable, where the address and port of the local endpoint is copied to.

Return Values

  • 0: The function completed successfully.
  • WSA_INVALID_PARAMETER (87): The specified socket index was invalid.
  • SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code.

Example