NETACCEPTON

Synopsis
NETACCEPTON localport sendready receiveready
Description

Enables you to accept a connection over the network on the localport. When data are available, FMSLogo runs the receiveready instruction list. To obtain the data received, run NETACCEPTRECEIVEVALUE in your 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 must wait until FMSLogo runs the sendready instruction list before trying to send the data again. Note you cannot just send data from the sendready callback, it won't be run unless the previous send was blocked. To stop accepting connections, run NETACCEPTOFF.

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

The localport input is an integer between 1 and 65535 that is used to identify which local port to listen on. 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) to run when data is ready to send again. The first time sendready is run is when FMSLogo successfully invokes accept. The second time sendready is run is when FMSLogo accepts a connection. The third time sendready is run is when FMSLogo is ready to send data. After that, sendready is run when FMSLogo 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) to run when data are available. FMSLogo runs it whenever data is received and is ready to be read.

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

NETACCEPTOFF
NETSHUTDOWN

SourceForge.net Logo