SysSock2Htonl (FUN) ¶ FUNCTION SysSock2Htonl : 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 SysSock2Htonl UDINT Converted UDINT value Input ulHost UDINT Host value
SysSock2InetAddr (FUN) ¶ FUNCTION SysSock2InetAddr : RTS_IEC_RESULT Convert an IP address string into an IP address. InOut: Scope Name Type Comment Return SysSock2InetAddr RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input szIPAddress REFERENCE TO STRING Pointer to get IP address string (must be at least 16 bytes long) pInAddr POINTER TO UDINT Pointer to IP address description
SysSock2InetNtoa (FUN) ¶ FUNCTION SysSock2InetNtoa : RTS_IEC_RESULT Convert IP address to a string. InOut: Scope Name Type Comment Return SysSock2InetNtoa RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input pInAddr POINTER TO INADDR Pointer to IP address description szIPADDR REFERENCE TO STRING Pointer to get IP address string (must be at least 16 bytes long) diIPAddrSize DINT Maximum length of szIPAddr
SysSock2Ioctl (FUN) ¶ FUNCTION SysSock2Ioctl : RTS_IEC_RESULT Io-control of a socket. InOut: Scope Name Type Comment Return SysSock2Ioctl RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket diCommand DINT Io-control command pdiParameter POINTER TO DINT Parameter value of the command
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)