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
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
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