SysSockAccept (FUN)

FUNCTION SysSockAccept : 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).
InOut:

Scope

Name

Type

Comment

Return

SysSockAccept

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)