tSysSockRecvFrom (STRUCT) ¶ TYPE tSysSockRecvFrom : STRUCT InOut: Name Type Comment pbyBuffer POINTER TO BYTE diBufferSize __XINT diFlags DINT pSockAddr POINTER TO SOCKADDRESS diSockAddrSize DINT pResult POINTER TO RTS_IEC_RESULT pdiOut POINTER TO __XINT Received
tSysSockRecvFromUdp (STRUCT) ¶ TYPE tSysSockRecvFromUdp : STRUCT InOut: Name Type Comment pbyData POINTER TO BYTE diDataSize __XINT pReply POINTER TO UDP_REPLY pResult POINTER TO RTS_IEC_RESULT pdiOut POINTER TO __XINT Received
tSysSockSelect (STRUCT) ¶ TYPE tSysSockSelect : STRUCT InOut: Name Type Comment diWidth DINT pFDRead POINTER TO SOCKET_FD_SET pFDWrite POINTER TO SOCKET_FD_SET pFDExcept POINTER TO SOCKET_FD_SET ptvTimeout POINTER TO SOCKET_TIMEVAL pdiReady POINTER TO DINT pulOut POINTER TO RTS_IEC_RESULT Result
tSysSockSend (STRUCT) ¶ TYPE tSysSockSend : STRUCT InOut: Name Type Comment pbyBuffer POINTER TO BYTE diBufferSize __XINT diFlags DINT pResult POINTER TO RTS_IEC_RESULT pdiOut POINTER TO __XINT Send
SysSockHtonl (FUN) ¶ FUNCTION SysSockHtonl : UDINT Converts a value of type UDINT from host byte order to the order of the TCP/IP network. InOut: Scope Name Type Comment Return SysSockHtonl UDINT Converted UDINT value Input ulHost UDINT Host value
SysSockRecvFrom (FUN) ¶ FUNCTION SysSockRecvFrom : __XINT Receive a message from a connectionless socket (UDP). NOTE: With some IP stacks (LwIP for example, which is used with the CODESYS Control RTE), it is necessary to set the SOCKET_SO_BROADCAST socket option (SOCKET_SOL level) in order to be able to receive broadcast UDP messages with the SysSockRecvMsg() and SysSockRecvFrom() functions. InOut: Scope Name Type Comment Return SysSockRecvFrom __XINT Number of bytes received Input hSocket RTS_IEC_HANDLE Handle to the socket pbyBuffer POINTER TO BYTE Buffer to read data from the socket diBufferSize __XINT Maximum length of the buffer diFlags DINT The flags parameter can be used to influence the behavior of the function beyond the options specified for the associated socket. The semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by using the bitwise OR operator with any of the SOCKET_MSG values. pSockAddr POINTER TO SOCKADDRESS Socket address and port to receive data from diSockAddrSize DINT Size of socket address structure pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockRecvFromUdp2 (FUN) ¶ FUNCTION SysSockRecvFromUdp2 : __XINT Receive a paket from a UDP socket. InOut: Scope Name Type Comment Return SysSockRecvFromUdp2 __XINT Number of bytes received Input hSocketUdp RTS_IEC_HANDLE Handle to the UDP socket pbyData POINTER TO BYTE Pointer to data to receive diDataSize __XINT Size of data to receive pReply POINTER TO UDP_REPLY2 Description of the client that has sent this paket pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockRecvFromUdp (FUN) ¶ FUNCTION SysSockRecvFromUdp : __XINT Receive a paket from a UDP socket. InOut: Scope Name Type Comment Return SysSockRecvFromUdp __XINT Number of bytes received Input hSocketUdp RTS_IEC_HANDLE Handle to the UDP socket pbyData POINTER TO BYTE Pointer to data to receive diDataSize __XINT Size of data to receive pReply POINTER TO UDP_REPLY Description of the client that has sent this paket pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockRecvMsg (FUN) ¶ FUNCTION SysSockRecvMsg : __XINT Receives a message from a socket. NOTE: For querying the SOCKET_MSG_BCAST message flag the IP_PKTINFO socket option has to be set on the socket. NOTE: With some IP stacks (LwIP for example, which is used with the CODESYS Control RTE), it is necessary to set the SOCKET_SO_BROADCAST socket option (SOCKET_SOL level) in order to be able to receive broadcast UDP messages with the SysSockRecvMsg() and SysSockRecvFrom() functions. NOTE: If no messages are available at the socket and SOCKET_FIONBIO is not set on the socket, SysSockRecvMsg() shall block until a message arrives. InOut: Scope Name Type Comment Return SysSockRecvMsg __XINT Upon successful completion, SysSockRecvMsg() shall return the length of the message in bytes. If no messages are available to be received and the peer has performed an orderly shutdown, SysSockRecvMsg() shall return 0 and set * pResult to ERR_SOCK_CLOSED. Otherwise, the function shall return 0 and set * pResult to indicate the error. Input hSocket RTS_IEC_HANDLE Handle to the socket. pMessage POINTER TO SOCK_RECVMSG_MSG Points to a SOCK_RECVMSG_MSG structure, containing both the buffer to store the source address and the buffer for the incoming message. The length and format of the address depend on the address family of the socket. The msgFlags and msgFlagsSupported members are ignored on input, but may contain meaningful values on output. flags DWORD Specifies the type of message reception. Values of this argument are formed by logically OR’ing zero or more of the SOCKET_MSG values. See category “Message flags”. pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockSelect (FUN) ¶ FUNCTION SysSockSelect : RTS_IEC_RESULT Check a number of sockets for activity. InOut: Scope Name Type Comment Return SysSockSelect RTS_IEC_RESULT Runtime system error code (see CmpErrors.library): ERR_OK ERR_SOCK_TIMEDOUT, if timeout expired Input diWidth DINT Number of sockets in the |SOCKET_FD_SET| structure, so |SOCKET_FD_SETSIZE| must be used here. pfdRead POINTER TO SOCKET_FD_SET Optional pointer to the structure |SOCKET_FD_SET| defining the socket set to be checked for reading. It is also possible to set this parameter to 0. pfdWrite POINTER TO SOCKET_FD_SET Optional pointer to the structure |SOCKET_FD_SET| defining the socket set to be checked for writing. It is also possible to set this parameter to 0. pfdExcept POINTER TO SOCKET_FD_SET Optional pointer to structure |SOCKET_FD_SET| that defines the socket set the error state has to be checked. It is also possible to set this parameter to 0. ptvTimeout POINTER TO SOCKET_TIMEVAL Pointer to maximum timespan which the function SysSockSelect waits for a response: ptvTimeout=NULL: Infinite wait ptvTimeout->tv_sec=-1, ptvTimeout->tv_usec=-1: Infinite wait ptvTimeout->tv_sec=0, ptvTimeout->tv_usec=0: No wait pdiReady POINTER TO DINT Number of sockets that are ready for IO