SysSock2Listen (FUN) ¶ FUNCTION SysSock2Listen : RTS_IEC_RESULT Listen on a TCP server socket for new connection. InOut: Scope Name Type Comment Return SysSock2Listen RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket diMaxConnections DINT Maximum number of connections allowed
SysSock2Ntohl (FUN) ¶ FUNCTION SysSock2Ntohl : UDINT Convert a UDINT value from ethernet byte order into host format. InOut: Scope Name Type Comment Return SysSock2Ntohl UDINT Converted UDINT value Input ulNet UDINT Ethernet value
SysSock2Ntohs (FUN) ¶ FUNCTION SysSock2Ntohs : WORD Convert a WORD value from ethernet byte order into host format. InOut: Scope Name Type Comment Return SysSock2Ntohs WORD Converted WORD value Input usNet WORD Ethernet value
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)
SysSockBind (FUN) ¶ FUNCTION SysSockBind : RTS_IEC_RESULT Bind a socket to a socket address and port number. This functions calls the function bind of the operating system, which will assign a local address to a socket that has already been allocated to an address by SysSockCreate , but not yet fixed uniquely. This is usually done previous to a call to functions like SysSockListen or SysSockAccept . InOut: Scope Name Type Comment Return SysSockBind RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket pSockAddr POINTER TO SOCKADDRESS Spcket address diSockAddrSize DINT Size of the socket address structure
SysSockClose (FUN) ¶ FUNCTION SysSockClose : RTS_IEC_RESULT Close a socket. InOut: Scope Name Type Comment Return SysSockClose RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket
SysSockCloseUdp (FUN) ¶ FUNCTION SysSockCloseUdp : RTS_IEC_RESULT Close a UDP socket. Handle must be retrieved by SysSockCreateUdp ! This function calls the function closesocket of the operating system to close a socket working with the user datagram protocol UDP. InOut: Scope Name Type Comment Return SysSockCloseUdp RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocketUdp RTS_IEC_HANDLE Handle to the UDP socket. Must be opened with SysSockCreateUdp !
SysSockConnect (FUN) ¶ FUNCTION SysSockConnect : RTS_IEC_RESULT Connect as a client to a TCP server. InOut: Scope Name Type Comment Return SysSockConnect RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket pSockAddr POINTER TO SOCKADDRESS Socket address of the server to connect to diSockAddrSize DINT Size of socket address structure
SysSockCreate (FUN) ¶ FUNCTION SysSockCreate : RTS_IEC_HANDLE Create a new socket and return the socket handle. InOut: Scope Name Type Comment Return SysSockCreate RTS_IEC_HANDLE Handle to the new socket. The return is a descriptor (handle) of the new socket, which is required as input parameter by other library functions like SysSockBind , SysSockConnect etc. Input iAddressFamily INT Socket address family diType DINT Socket type diProtocol DINT Socket protocol pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockCreateUdp (FUN) ¶ FUNCTION SysSockCreateUdp : RTS_IEC_HANDLE Higher level function, to create a complete UDP socket. The socket will make use of the user data protocol UDP. InOut: Scope Name Type Comment Return SysSockCreateUdp RTS_IEC_HANDLE Handle to the UDP socket Input diSendPort DINT Port number to send (host byte order) diRecvPort DINT Port number to receive (host byte order) pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)