Next Previous Contents

2. Usinagaz

The main software!

2.1 CHAT

Takes a chat-list (ie a string list like { "wait1" "send1" "wait2" ...} ) and applies it on the serial port (see 'man chat' for Unix users):

example: { "" "hello" "hi" "how are you?" "nice" } CHAT will:

If the machine which is connected to your hp doesn't says what is waited for, CHAT may hang (pressing ON can still interrupt it), for example, if it replies "hello" to our "hello", CHAT will hang, but if it replies "philosophically enough, hello", it won't, since this indeed contains 'hi' (even twice)!

This is quite useful so as to connect to an isp via a modem.

If you set flag 32 (32 SF), the last line of the screen shows the current expected Question, and the discussion is shown over it. It is mostly used for debugging.


Does ppp negociation, ie compression and IP adress negociation. Hold DROP down if you want to abort negociation.

Annunciators should light while the negociation is processed (No, it's not christmas ;-).


LCP Request was sent

<- ->      

LCP Ack was received

<- -> a    

LCP Ack was sent

<- -> a (*)

LCP negociation was done

   -> a (*)

IPCP request was sent

      a (*)

IPCP Ack was received


IPCP Ack was sent


IPCP negociation was done

If connection doesn't seem to get establised, a Timeout error is raised. You can force Timeout by pressing left shift for instance (way to abort connection).

If you need PAP authentication, push login and password onto the stack before calling PPPON. They won't be dropped, but will be copied in Upar for future calls (hence you won't have to enter them again). Beware! If you call PPPON with two strings pushed onto the stack (which are not your password or login), you may get an error... Yes, it's weird, and I'll look for another solution if someone really needs it.

example: "mylogin" "mypassword" PPPON


Cuts ppp connection down.

If connection doesn't seems to get down, a Timeout error is raised. You can force Timeout by pressing left shift for instance.


just call it from time to time so that basic services can work (icmp for instance) and buffers can be flushed.

If a ppp disconnection or a tcp RST happens, an error is raised.


Must be called to get a socket (for now, only socket <0h> is supported). Takes an approx real number: 0. for dgram (UDP), 1. for stream (TCP), 2. for raw. It gives a strange object which looks like <0h>. This "Magic socket number" *must* be kept untouched: just store it in a local variable so as to be able to give it back.

Some day, when I have time to loose, I will implement multi socket...

example: 1. USOCKET -> s \<< blabla... \>> to get a socket number.

Warning: when you call USOCKET, flags 33, 34 and 35 are cleared for compatibility. See UREAD for more details.


If you want your local port to be something else than default, call UBIND with the magic socket number and the binary int corresponding to the wanted local port. If you want to go back to a default port, call it with #0

example: s #25d UBIND if you want to be a smtp server. (s holds the magic socket number)


Before sending or receiving, you must say to whom and on which port you want to connect. It takes a magic socket number, the IP address, and the remote port to connect to, the two latter being binary ints. If that socket is a TCP one, Usinagaz will duly connect, or else only recording is done.

example: s "" #25d UCONNECT if you want to connect to your isp's e-mail service.

If connection doesn't seem to get established, a Timeout error is raised.


If the socket is a TCP one, to UCLOSE ourself is mandatory, so do it as soon as you've finished sending your data, giving it your magic socket number. This will also free the socket for other applications.

example: s UCLOSE

Please always try to close sockets, even when your application terminates on some error!


Takes a string and a magic socket number, and sends the string using that socket's parameters.

example: "HELO" s UWRITE

If data doesn't seem to get acked by the peer, a Timeout error is raised. No assumption can then be made about what data was effectively received, so that your application should handle this problem, or the connection should be cut off and retried.

2.10 UREAD

Takes a magic socket number, and waits for some data on that socket then pushes it as a string. Hold DROP down if you want to stop waiting.

Warning! No NEWOB is done on the string, you must do it yourself if you want.

example: s UREAD

If no data seems to arrive, an empty string is returned after some time.

If you chose TCP, and the peer disconnected, you get a "disconnected" error, and you *must* disconnect yourself using UCLOSE, as soon as you want (you may still want to send data before doing this)

You may not want to wait, and read what is ready. For this, set flag 33 (33 SF). On the contrary, you may want to fill the buffer as much as possible, and only get back when buffer is full or timed out. For this, set flag 35 (35 SF)

Usinagaz doesn't treat data by default. However, if you only want to get a line from the buffer, leaving the rest for future use, please set flag 34 (34 SF). Usinagaz will then recognize the CR+LF, LF, CR and LF+CR sequences, only push what precedes the first occurence, and drop these sequences.


Takes a magic socket number, and waits until a connection to the hp is tried on that socket. The result is another magic socket number, on which you can then use UREAD, UWRITE and UCLOSE.

example: s UACCEPT

If you stop being patient, you may press DROP to stop UACCEPT. You then get an "interrupted" error.


PPPON automatically gets DNS addresses when connecting, so that you can use RESOLV to translate a domain name into an IP

example: "" RESOLV

note: Applied to an IP (already resolved), it does nothing, and applied to "" ie the dotted decimal representation, it returns #0A0B0C0D, as expected, without asking to any server, you even needn't be connected! "0" returns remote host's ip

note: The returned object is always the same, so if you want to keep several results, call NEWOB on them or else you'll just get the last result.

important note: always call RESOLV *before* establishing your socket: RESOLV itself needs a socket to make the resolution, so it would destroy your own socket.


Given a socket number, returns a mask containing only that socket number. Masks can be ORed and ANDed thanks to usual AND and OR functions.

example: s USOCK2MASK

note: The returned object is always the same, so if you want to keep several results, call NEWOB on them or else you'll just get the last result.


Given a read mask, a write mask, an exception, and a timeout (in 1024th of second, as a real), wait until some socket is ready for read, write or exceptionnal event, or the timeout expires. Timeout >= 1048576 means indefinite timeout. The result is the modified masks, in the same order.

example: s USOCK2MASK #0 #0 0 immediately returns #0 #0 #0 if s is not ready for reading, or #1 #0 #0 if (s is <0h> and) is ready for reading.

s USOCK2MASK #0 #0 1024 immediately returns #1 #0 #0 if (s is <0h> and) is ready for reading. Else it waits at most for a second for this to happen.


Returns the content of a given option:


Local IP (the IP of the calculator)


Remote IP (the IP of the computer which the calculator is connected to)


Number of DNS servers


IP of first DNS server


IP of second DNS server





example: #0 UGETOPT


Sets some option. See previous section for the list of options. Can be useful to set DNS servers by hand:

#2 #2 USETOPT #0A000001 #3 USETOPT #0A000002 #4 USETOPT

Next Previous Contents