SysSock2GetSockName (FUN) ¶ FUNCTION SysSock2GetSockName : RTS_IEC_RESULT Returns the socket address of the local socket. Usally this function is called to retrieve the local socket address on multihomed hosts or to get the local port number in client implemntations. If the socket is neither connected nor locally bound to an address, the result of the function and the value stored in the object pointed to by pSockAddress is unspecified. InOut: Scope Name Type Comment Return SysSock2GetSockName 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 local socket pdiSockAddrSize POINTER TO DINT Pointer to size of socket address structure
SysSock2Htons (FUN) ¶ FUNCTION SysSock2Htons : WORD Converts a value of type short from order of the TCP/IP network to the host byte order. InOut: Scope Name Type Comment Return SysSock2Htons WORD Converted WORD value Input usHost WORD Ethernet value
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