Skip to main content
Open topic with navigation CAPL Functions » TCP/IP API » TcpListen

TcpListen

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

Method Syntax

Method Syntax

Description

The function causes the socket to listen for incoming connection requests, which will be provided in the CAPL callback OnTcpListen, if it is implemented in the same CAPL program. If the operation fails, the function will return SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. The socket must have been opened beforehand with TcpOpen and be bound at least to one port. The binding to the port is carried out during opening or using IpBind. The additional binding to an IP address is optional. Incoming connections on the listen socket must be accepted with TcpAccept because all other connections will otherwise be refused with error 10061 (Connection refused).

Parameters

  • socket: The socket handle.

Return Values

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

Example

Create TCP Client and Server Sockets