TcpConnect
Valid for: CANoe DE • CANoe4SW DEFunction Syntax
long TcpConnect( dword socket, dword address, dword port); // form 1long TcpConnect( dword socket, byte ipv6Address[], dword port); // form 2long TcpConnect( dword socket, IP_Endpoint remoteEndpoint ); // form 3
Method Syntax
socket.Connect( dword address, dword port); // form 1socket.Connect( byte ipv6Address[], dword port); // form 2socket.Connect( IP_Endpoint remoteEndpoint ); // form 3
Description
The function establishes a connection with the specified location. Use IpGetLastSocketError to get a more specific error code. The specific error code is WSAWOULDBLOCK (10035), which is not a “real” error but confirms the non-blocking socket behavior. A real connection error is different from error 10035. The CAPL callback OnTcpConnect will be called on completion (successful or not), provided it is implemented in the same CAPL program. On the remote station OnTcpListen is called up, which accepts the connection with TcpAccept.Parameters
- socket: The socket handle.
- address: The numerical IPv4 address of the destination.
- ipv6Address: The numerical IPv6 address of the destination in a 16 byte array.
- port: The port of the destination in host-byte order.
-
remoteEndpoint: The destination endpoint. IP address and port number must be specified.
Example:
IP_Endpoint( 192.168.1.1:40001 )IP_Endpoint( [FC00::0001]:40001 )
Return Values
- WSA_INVALID_PARAMETER (87): The specified socket was invalid.
- SOCKET_ERROR (-1): Call IpGetLastSocketError to get a more specific error code. If the error code is different from 10035 this indicates a connection error.