Specifications

Chapter 18. TCP/IP
435
Syntax:
CALL "SOCKET.FN3" 11 NETLONG, HOSTLONG
Description: This function converts a (4-byte) long from network byte to host byte order.
BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4
socket API ntohl() function.
Parameters:
NETLONG Long in network byte order
Return value: HOSTLONG Long in host byte order
Syntax:
CALL "SOCKET.FN3" 12 NETSHORT%, HOSTSHORT%
Description: This function converts a (2-byte) short from network byte order to host byte
order.
BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4
socket API ntohs() function.
Parameters:
NETSHORT% Short in network byte order
Return value: HOSTSHORT% Short in host byte order
Syntax: CALL "SOCKET.FN3" 14 SOCKFD%, RECVBUFF$[()],
RECVLEN%, RECVMODE%, RECVSIZE% [,RECVFLAG%]
Description: This function receives data from the IP address and port number con-
nected to the specified socket identifier into the specified buffer.
BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4
socket API recv() function.
Parameters: SOCKFD% Socket identifier
RECVBUFF$[()] Receive buffer
RECVLEN% Maximum number of bytes to receive
RECVMODE% Receive mode
RECVFLAG% Storage method (optional)
The receive buffer (
RECVBUFF$) can be either a string or string array
variable. The maximum size for a string is 255 bytes; for a string array,
4096.
The receive mode (
RECVMODE%) must be one of the following values:
0Normal
1 Out of band data
2 Peek at next message
The storage method (RECVFLAG%) is required for a string array buffer. It
is ignored for a string variable and new data will be written.
Function #11: Convert network long (4 bytes) to host byte order
Function #12: Convert network short (2 bytes) to host byte order
Function #14: Receive message from TCP socket