Chapter 18. TCP/IP
475
Syntax:
CALL
"SOCKET.FN3"
.fcNToHS
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"
.fcRecv
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 non-array 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:
The storage method (
RECVFLAG%
) is required for a string array buffer. It
is ignored for a string variable and new data will be written.
The storage method (
RECVFLAG%
) must be one of the following values:
Note: If
RECVFLAG%
is 0 or omitted, the user application program must
initialize the receive buffer string array variable before receiving any data.
Return value:
RECVSIZE%
Number of bytes received
.fcNToHS
Convert network short (2 bytes) to host byte order
.fcRecv
Receive data sent to the specified TCP socket
.soRvNrm
0
Normal
.soRvOOB
1
Out of band data
.soRvPeek
2
Peek at next message
.soRvApend
0
Append data to buffer (default if omitted)
.soRvWrite
1
Overwrite buffer with data
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...