NETACCEPTSENDVALUE

Synopsis
NETACCEPTSENDVALUE data
Description

Sends data out the accept socket.

The data input may be a word, a list, or an array. The data are sent as if printed by PRINT, without the final newline. The network payload is encoded according to the system default Windows code page of the host operating system, followed by a 0 byte.

NETACCEPTSENDVALUE outputs TRUE if data were successfully queued to be sent. Otherwise, it outputs FALSE (meaning that it's not ready to send). If it outputs FALSE, you must wait until the sendready input list of NETACCEPTON is run before sending on it again.

Example

This example sets up a client and server on the same machine. The server (accepter) sends data to whomever connected.

NETSTARTUP ; Start up the network

; Wait for someone to connect to you on local port 5124
SHOW NETACCEPTON 5124 [PRINT [Ok to Send Again]] []
true
Ok to Send Again

; Connect to the local machine on port 5124.
; If you want to run this portion on a different computer, then replace
; the "localhost with the name of the other computer.
SHOW NETCONNECTON "localhost 5124 [] [PRINT NETCONNECTRECEIVEVALUE]
true

WAIT 100 ; Wait little for connection to establish
Ok to Send Again
Ok to Send Again

SHOW NETACCEPTSENDVALUE [Who are you that called me] ; Send some data
true

WAIT 100 ; Wait a little before we shut things down
Who are you that called me

NETCONNECTOFF
NETACCEPTOFF
NETSHUTDOWN


SourceForge.net Logo