8.7.0 Basic Server-side Sockets

Startup

On the startup line, specify the socket to listen on:

./basic SOCKET=socket IPLFILE

Where socket is a numerical socket value to listen on.

ERR=13 results when trying to READ or WRITE to a socket if no socket was specified at startup (see code below).

Using Sockets

This is a listening (i.e. passive) socket, so a READ is done first on channel 0 as shown in the following example:

>READ(0, OPT="SOCKET" [,TIM=timoutval]) A$

You can perform multiple READ and WRITE directives. The conversation is only terminated with:

>WRITE(0,OPT="SOCKET|CLOSE") "some data going back"

Using the TIM= option is recommended to prevent the appearance that Basic hangs. If no TIM= is present, the READ will wait for a connection indefinitely