SysSock2Accept (FUN)

FUNCTION SysSock2Accept : RTS_IEC_HANDLE

Accept the next incoming TCP connection.
This functions calls the function accept of the operating system, which can accept a request to connect
to a socket. A new descriptor (handle) for the socket is returned. The original socket is reset to the
“listening” state (see SysSockListen).

Note

For TLS Sockets the blocking mode will be set to nonblocking for the new client sockets. If a blocking behavior is needed use SysSock2Ioctl to set the socket to blocking mode. This reflects the behavior of SysSock2Create for TLS sockets.

InOut:

Scope

Name

Type

Comment

Return

SysSock2Accept

RTS_IEC_HANDLE

Handle to the new accepted socket or RTS_INVALID_HANDLE if failed.

Input

hSocket

RTS_IEC_HANDLE

Handle to the socket

pSockAddr

POINTER TO SOCKADDRESS

Socket address of the client, who is connected

pdiSockAddrSize

POINTER TO DINT

Pointer to size of socket address structure

pResult

POINTER TO RTS_IEC_RESULT

Pointer to runtime system error code (see CmpErrors.library)