User guide

136 CHAPTER 6. CINTPOS DEVICES
6.0.5 The Keyboard Device
This device has i d entifier -2 and is currently not treated specially, and so it has a DCB,
and a device thread that is continually trying to read character from standard input
which is normally the keyboard. Packets for thi s device are placed on the end of the
work que ue held in the dcb wkq field of the DCB. When a character becomes available
it is placed in the pkt
res1 field of the first packet in the queue before returning the
packet to its task.
It is planned to modify keyboard packets to allow them to handle time out s. This
will be done by setting the pkt
arg1 field to a timeout value. If it is is negative no
timeout is used and the packet will remain with the device until a character is received,
otherwise it specifies a timeout in milliseconds. If no character is recei ved within that
time, pollingch (=-2) is returned in the res1 field, but i f a character becomes available
within that time it it returned in the normal way.
6.0.6 The Screen Device
This device has identifier -3 and is treated specially. The pkt
arg1 field of the packet
holds the next character to send to the screen and when t hi s transfer is complete the
packet is returned to the client task. Normally output to the screen cause s no real time
delay.
6.0.7 TCP/IP Devices
TCP/IP devices provide a mechanism to communicate with other machines over the
internet. The pkt
type field specified the TCP/IP operation required and the argument
field provide additional information about the request. The possible packet type are
as follows.
Tcp
name2ipaddr arg1: name
This looks up the URL name and re tur n s its IP address . Names such as 127.0.0.1
are allowed.
Tcp
name2port arg1: name
This looks up the the give n port name and returns its its number.
Tcp
socket
This attempts to create a port for a two way byte stream using the IPv4 protocol.
If the result is -1 there was an error, otherwise it returns the number of the new socket.
Tcp
reuseaddr arg1: sock arg2: flag
If flag=1 this modifies the socket sock to allow reuse of local addresses, otherwise
these are disallowed. A result of zero indicates success.
Tcp
sndbufsz arg1: sock arg2: size
This sets the send buffer size of the given socket to size bytes. A zero result i nd i cat es
success.