NETCONNECTON

Synopsis
NETCONNECTON remotemachinename remoteport sendready receiveready
Description

Initiates a connection over the network to the TCP port remoteport on remotemachinename. To turn off the connection call NETCONNECTOFF. To obtain the data received call NETCONNECTRECEIVEVALUE in your receiveready instruction list. When you actually send data with NETCONNECTSENDVALUE it might output FALSE (meaning that it's not ready to send). If this happens you must wait until the sendready callback code is run before trying to send the data again. Note you cannot just send data from the sendready callback code, it won't be run unless the previous send was blocked.

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

The remotemachinename input is a DNS host name or an IP address. It can be a list or a word.

The remoteport input is an integer that is used to identify which remote TCP port to connect to.

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 the connection request. The second time sendready is run is when FMSLogo actually connects to the remote machine. The third time sendready is run is when FMSLogo is ready to send on the connection. After that, sendready is run when FMSLogo is ready to send after an earlier call to NETCONNECTSENDVALUE failed.

The receiveready input is an instruction list (a list of instructions or a procedure name) to run when data are available. It is run whenever data is received and is ready to be read.

Example

This example assumes that a machine named "remotemachinename" is listening on port 5124.

NETSTARTUP ; Start up the network
SHOW NETCONNECTON "remotemachinename 5124 [PRINT [ready to send again]] [PRINT [I have something]]
true

NETCONNECTOFF
NETSHUTDOWN


SourceForge.net Logo