NETACCEPTON

Synopsis
NETACCEPTON localport sendready receiveready
Description

Listens for and accepts new network connections on TCP port localport. When data are received from the remote host, FMSLogo runs the receiveready instruction list. When you send data with NETACCEPTSENDVALUE it might output FALSE (meaning that it's not ready to send). If this happens you won't be able to send more data until FMSLogo runs the sendready instruction list again.

To stop accepting connections, run NETACCEPTOFF.

NETACCEPTON outputs TRUE if the operation was successful. Otherwise, it outputs FALSE.

The localport input is the local TCP port on which to listen for new connections. It must be an integer between 1 and 65535. The port must not already be in use by some other service on the machine. It is recommended that you use ports numbers greater than 1024.

The sendready input is an instruction list (a list of instructions or a procedure name) that is run multiple times:

  1. When FMSLogo successfully invokes listen.

  2. When a client connects to FMSLogo.

  3. When FMSLogo is ready to send data to the client.

  4. When a second client connects to FMSLogo.

  5. When FMSLogo is ready to send data to the second client.

  6. And so on for each new client...

FMSLogo also runs the sendready instruction list when it is ready to send after an earlier call to NETACCEPTSENDVALUE failed.

The receiveready input is an instruction list (a list of instructions or a procedure name) which FMSLogo runs it whenever it receives data from the client. To obtain the data received, run NETACCEPTRECEIVEVALUE from the receiveready instruction list.

Example
NETSTARTUP ; Start up the network

; Wait for someone to connect to you on port 5124
SHOW NETACCEPTON 5124 [PRINT [Ready to send]] [PRINT [Ready to receive]]
true
Ready to send

NETACCEPTOFF
NETSHUTDOWN

SourceForge.net Logo