Home » Archimedes archive » Acorn User » AU 1995-05.adf » !Internet_StarterPak » !TCPIP/TCPIP_Doc/Notes/Chat

!TCPIP/TCPIP_Doc/Notes/Chat

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1995-05.adf » !Internet_StarterPak
Filename: !TCPIP/TCPIP_Doc/Notes/Chat
Read OK:
File size: 0A7A bytes
Load address: 0000
Exec address: 0000
File contents
Notes about chat sequences
--------------------------

With chat strings, the following escape sequences are recognised in both
expect and send strings:

  \\  as  \
  \"  as  " (double quote)
  \a  as  bell (7)
  \b  as  backspace (8)
  \t  as  tab (9)
  \n  as  linefeed, (10)
  \v  as  vertical tab (11)
  \f  as  form feed (12)
  \r  as  carriage return, (13)
  \e  as  escape (27)

The strings must be in pairs, of which the first string is an expect
string.

Expect strings are currently case sensitively matched against ALL
received characters that are NOT part of a VT100 escape sequence
(except the initial ESC characater), including control characters.

Expect strings may be specified as "" for a null string, though
currently this equates to any character, rather than send the following
send string immediately.

Send strings may be specified as "" null string. This may be used to ensure
two separate, and possibly separated string matches are done before a
send string is sent.

Expect/Send pairs need not be enclosed in quotes, unless the string
includes a space character, or is a null string.

No additional characaters are appended to send strings, to if you want
an EOL in the send string, you must specfiy it, eg "\r\n".

The chat handler works in parellel with user input, thus pressing keys
on the keyboard, or keypad will have their usual effect. If local echo,
or line edit mode is being used, entered characters are treated as part of
the received character stream.

The maximum length of a expect string is currently 16 characters.

Not all of the above may suit everyone, but at least you know how it
behaves, and thus what to expect from it.

I may, at some time, extend the string handling to allow optional
case-insenstive matching, optional filtering of control characters from
received stream, inclusion of \x00 type escape sequences, pause delays,
timeouts and embed terminal switch commands in send strings, eg for
switching a spool on/off.

---

* A note about !TCPIP command parsing: Older versions of !TCPIP could
  accept upto 10 separate tokens per command. I am not sure what maximum
  command length was acceptable, though I think it was 80 or charcters
  including end of line and string terminator.

  In order to cope with terminal switch tokens, net, terminal and chat
  command separators, chat strings etc, the maximum number of tokens has
  now been increased to 64, and the command line length in the command
  box at the top of terminal windows is now 1020 characters (allowing for
  "\r\n\0" to be appended.
  
  Maximum in-window, (ie at the prompt) command line length is from the
  prompt to the end of the line, ie variable.

00000000  4e 6f 74 65 73 20 61 62  6f 75 74 20 63 68 61 74  |Notes about chat|
00000010  20 73 65 71 75 65 6e 63  65 73 0a 2d 2d 2d 2d 2d  | sequences.-----|
00000020  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000030  2d 2d 2d 2d 2d 0a 0a 57  69 74 68 20 63 68 61 74  |-----..With chat|
00000040  20 73 74 72 69 6e 67 73  2c 20 74 68 65 20 66 6f  | strings, the fo|
00000050  6c 6c 6f 77 69 6e 67 20  65 73 63 61 70 65 20 73  |llowing escape s|
00000060  65 71 75 65 6e 63 65 73  20 61 72 65 20 72 65 63  |equences are rec|
00000070  6f 67 6e 69 73 65 64 20  69 6e 20 62 6f 74 68 0a  |ognised in both.|
00000080  65 78 70 65 63 74 20 61  6e 64 20 73 65 6e 64 20  |expect and send |
00000090  73 74 72 69 6e 67 73 3a  0a 0a 20 20 5c 5c 20 20  |strings:..  \\  |
000000a0  61 73 20 20 5c 0a 20 20  5c 22 20 20 61 73 20 20  |as  \.  \"  as  |
000000b0  22 20 28 64 6f 75 62 6c  65 20 71 75 6f 74 65 29  |" (double quote)|
000000c0  0a 20 20 5c 61 20 20 61  73 20 20 62 65 6c 6c 20  |.  \a  as  bell |
000000d0  28 37 29 0a 20 20 5c 62  20 20 61 73 20 20 62 61  |(7).  \b  as  ba|
000000e0  63 6b 73 70 61 63 65 20  28 38 29 0a 20 20 5c 74  |ckspace (8).  \t|
000000f0  20 20 61 73 20 20 74 61  62 20 28 39 29 0a 20 20  |  as  tab (9).  |
00000100  5c 6e 20 20 61 73 20 20  6c 69 6e 65 66 65 65 64  |\n  as  linefeed|
00000110  2c 20 28 31 30 29 0a 20  20 5c 76 20 20 61 73 20  |, (10).  \v  as |
00000120  20 76 65 72 74 69 63 61  6c 20 74 61 62 20 28 31  | vertical tab (1|
00000130  31 29 0a 20 20 5c 66 20  20 61 73 20 20 66 6f 72  |1).  \f  as  for|
00000140  6d 20 66 65 65 64 20 28  31 32 29 0a 20 20 5c 72  |m feed (12).  \r|
00000150  20 20 61 73 20 20 63 61  72 72 69 61 67 65 20 72  |  as  carriage r|
00000160  65 74 75 72 6e 2c 20 28  31 33 29 0a 20 20 5c 65  |eturn, (13).  \e|
00000170  20 20 61 73 20 20 65 73  63 61 70 65 20 28 32 37  |  as  escape (27|
00000180  29 0a 0a 54 68 65 20 73  74 72 69 6e 67 73 20 6d  |)..The strings m|
00000190  75 73 74 20 62 65 20 69  6e 20 70 61 69 72 73 2c  |ust be in pairs,|
000001a0  20 6f 66 20 77 68 69 63  68 20 74 68 65 20 66 69  | of which the fi|
000001b0  72 73 74 20 73 74 72 69  6e 67 20 69 73 20 61 6e  |rst string is an|
000001c0  20 65 78 70 65 63 74 0a  73 74 72 69 6e 67 2e 0a  | expect.string..|
000001d0  0a 45 78 70 65 63 74 20  73 74 72 69 6e 67 73 20  |.Expect strings |
000001e0  61 72 65 20 63 75 72 72  65 6e 74 6c 79 20 63 61  |are currently ca|
000001f0  73 65 20 73 65 6e 73 69  74 69 76 65 6c 79 20 6d  |se sensitively m|
00000200  61 74 63 68 65 64 20 61  67 61 69 6e 73 74 20 41  |atched against A|
00000210  4c 4c 0a 72 65 63 65 69  76 65 64 20 63 68 61 72  |LL.received char|
00000220  61 63 74 65 72 73 20 74  68 61 74 20 61 72 65 20  |acters that are |
00000230  4e 4f 54 20 70 61 72 74  20 6f 66 20 61 20 56 54  |NOT part of a VT|
00000240  31 30 30 20 65 73 63 61  70 65 20 73 65 71 75 65  |100 escape seque|
00000250  6e 63 65 0a 28 65 78 63  65 70 74 20 74 68 65 20  |nce.(except the |
00000260  69 6e 69 74 69 61 6c 20  45 53 43 20 63 68 61 72  |initial ESC char|
00000270  61 63 61 74 65 72 29 2c  20 69 6e 63 6c 75 64 69  |acater), includi|
00000280  6e 67 20 63 6f 6e 74 72  6f 6c 20 63 68 61 72 61  |ng control chara|
00000290  63 74 65 72 73 2e 0a 0a  45 78 70 65 63 74 20 73  |cters...Expect s|
000002a0  74 72 69 6e 67 73 20 6d  61 79 20 62 65 20 73 70  |trings may be sp|
000002b0  65 63 69 66 69 65 64 20  61 73 20 22 22 20 66 6f  |ecified as "" fo|
000002c0  72 20 61 20 6e 75 6c 6c  20 73 74 72 69 6e 67 2c  |r a null string,|
000002d0  20 74 68 6f 75 67 68 0a  63 75 72 72 65 6e 74 6c  | though.currentl|
000002e0  79 20 74 68 69 73 20 65  71 75 61 74 65 73 20 74  |y this equates t|
000002f0  6f 20 61 6e 79 20 63 68  61 72 61 63 74 65 72 2c  |o any character,|
00000300  20 72 61 74 68 65 72 20  74 68 61 6e 20 73 65 6e  | rather than sen|
00000310  64 20 74 68 65 20 66 6f  6c 6c 6f 77 69 6e 67 0a  |d the following.|
00000320  73 65 6e 64 20 73 74 72  69 6e 67 20 69 6d 6d 65  |send string imme|
00000330  64 69 61 74 65 6c 79 2e  0a 0a 53 65 6e 64 20 73  |diately...Send s|
00000340  74 72 69 6e 67 73 20 6d  61 79 20 62 65 20 73 70  |trings may be sp|
00000350  65 63 69 66 69 65 64 20  61 73 20 22 22 20 6e 75  |ecified as "" nu|
00000360  6c 6c 20 73 74 72 69 6e  67 2e 20 54 68 69 73 20  |ll string. This |
00000370  6d 61 79 20 62 65 20 75  73 65 64 20 74 6f 20 65  |may be used to e|
00000380  6e 73 75 72 65 0a 74 77  6f 20 73 65 70 61 72 61  |nsure.two separa|
00000390  74 65 2c 20 61 6e 64 20  70 6f 73 73 69 62 6c 79  |te, and possibly|
000003a0  20 73 65 70 61 72 61 74  65 64 20 73 74 72 69 6e  | separated strin|
000003b0  67 20 6d 61 74 63 68 65  73 20 61 72 65 20 64 6f  |g matches are do|
000003c0  6e 65 20 62 65 66 6f 72  65 20 61 0a 73 65 6e 64  |ne before a.send|
000003d0  20 73 74 72 69 6e 67 20  69 73 20 73 65 6e 74 2e  | string is sent.|
000003e0  0a 0a 45 78 70 65 63 74  2f 53 65 6e 64 20 70 61  |..Expect/Send pa|
000003f0  69 72 73 20 6e 65 65 64  20 6e 6f 74 20 62 65 20  |irs need not be |
00000400  65 6e 63 6c 6f 73 65 64  20 69 6e 20 71 75 6f 74  |enclosed in quot|
00000410  65 73 2c 20 75 6e 6c 65  73 73 20 74 68 65 20 73  |es, unless the s|
00000420  74 72 69 6e 67 0a 69 6e  63 6c 75 64 65 73 20 61  |tring.includes a|
00000430  20 73 70 61 63 65 20 63  68 61 72 61 63 74 65 72  | space character|
00000440  2c 20 6f 72 20 69 73 20  61 20 6e 75 6c 6c 20 73  |, or is a null s|
00000450  74 72 69 6e 67 2e 0a 0a  4e 6f 20 61 64 64 69 74  |tring...No addit|
00000460  69 6f 6e 61 6c 20 63 68  61 72 61 63 61 74 65 72  |ional characater|
00000470  73 20 61 72 65 20 61 70  70 65 6e 64 65 64 20 74  |s are appended t|
00000480  6f 20 73 65 6e 64 20 73  74 72 69 6e 67 73 2c 20  |o send strings, |
00000490  74 6f 20 69 66 20 79 6f  75 20 77 61 6e 74 0a 61  |to if you want.a|
000004a0  6e 20 45 4f 4c 20 69 6e  20 74 68 65 20 73 65 6e  |n EOL in the sen|
000004b0  64 20 73 74 72 69 6e 67  2c 20 79 6f 75 20 6d 75  |d string, you mu|
000004c0  73 74 20 73 70 65 63 66  69 79 20 69 74 2c 20 65  |st specfiy it, e|
000004d0  67 20 22 5c 72 5c 6e 22  2e 0a 0a 54 68 65 20 63  |g "\r\n"...The c|
000004e0  68 61 74 20 68 61 6e 64  6c 65 72 20 77 6f 72 6b  |hat handler work|
000004f0  73 20 69 6e 20 70 61 72  65 6c 6c 65 6c 20 77 69  |s in parellel wi|
00000500  74 68 20 75 73 65 72 20  69 6e 70 75 74 2c 20 74  |th user input, t|
00000510  68 75 73 20 70 72 65 73  73 69 6e 67 20 6b 65 79  |hus pressing key|
00000520  73 0a 6f 6e 20 74 68 65  20 6b 65 79 62 6f 61 72  |s.on the keyboar|
00000530  64 2c 20 6f 72 20 6b 65  79 70 61 64 20 77 69 6c  |d, or keypad wil|
00000540  6c 20 68 61 76 65 20 74  68 65 69 72 20 75 73 75  |l have their usu|
00000550  61 6c 20 65 66 66 65 63  74 2e 20 49 66 20 6c 6f  |al effect. If lo|
00000560  63 61 6c 20 65 63 68 6f  2c 0a 6f 72 20 6c 69 6e  |cal echo,.or lin|
00000570  65 20 65 64 69 74 20 6d  6f 64 65 20 69 73 20 62  |e edit mode is b|
00000580  65 69 6e 67 20 75 73 65  64 2c 20 65 6e 74 65 72  |eing used, enter|
00000590  65 64 20 63 68 61 72 61  63 74 65 72 73 20 61 72  |ed characters ar|
000005a0  65 20 74 72 65 61 74 65  64 20 61 73 20 70 61 72  |e treated as par|
000005b0  74 20 6f 66 0a 74 68 65  20 72 65 63 65 69 76 65  |t of.the receive|
000005c0  64 20 63 68 61 72 61 63  74 65 72 20 73 74 72 65  |d character stre|
000005d0  61 6d 2e 0a 0a 54 68 65  20 6d 61 78 69 6d 75 6d  |am...The maximum|
000005e0  20 6c 65 6e 67 74 68 20  6f 66 20 61 20 65 78 70  | length of a exp|
000005f0  65 63 74 20 73 74 72 69  6e 67 20 69 73 20 63 75  |ect string is cu|
00000600  72 72 65 6e 74 6c 79 20  31 36 20 63 68 61 72 61  |rrently 16 chara|
00000610  63 74 65 72 73 2e 0a 0a  4e 6f 74 20 61 6c 6c 20  |cters...Not all |
00000620  6f 66 20 74 68 65 20 61  62 6f 76 65 20 6d 61 79  |of the above may|
00000630  20 73 75 69 74 20 65 76  65 72 79 6f 6e 65 2c 20  | suit everyone, |
00000640  62 75 74 20 61 74 20 6c  65 61 73 74 20 79 6f 75  |but at least you|
00000650  20 6b 6e 6f 77 20 68 6f  77 20 69 74 0a 62 65 68  | know how it.beh|
00000660  61 76 65 73 2c 20 61 6e  64 20 74 68 75 73 20 77  |aves, and thus w|
00000670  68 61 74 20 74 6f 20 65  78 70 65 63 74 20 66 72  |hat to expect fr|
00000680  6f 6d 20 69 74 2e 0a 0a  49 20 6d 61 79 2c 20 61  |om it...I may, a|
00000690  74 20 73 6f 6d 65 20 74  69 6d 65 2c 20 65 78 74  |t some time, ext|
000006a0  65 6e 64 20 74 68 65 20  73 74 72 69 6e 67 20 68  |end the string h|
000006b0  61 6e 64 6c 69 6e 67 20  74 6f 20 61 6c 6c 6f 77  |andling to allow|
000006c0  20 6f 70 74 69 6f 6e 61  6c 0a 63 61 73 65 2d 69  | optional.case-i|
000006d0  6e 73 65 6e 73 74 69 76  65 20 6d 61 74 63 68 69  |nsenstive matchi|
000006e0  6e 67 2c 20 6f 70 74 69  6f 6e 61 6c 20 66 69 6c  |ng, optional fil|
000006f0  74 65 72 69 6e 67 20 6f  66 20 63 6f 6e 74 72 6f  |tering of contro|
00000700  6c 20 63 68 61 72 61 63  74 65 72 73 20 66 72 6f  |l characters fro|
00000710  6d 0a 72 65 63 65 69 76  65 64 20 73 74 72 65 61  |m.received strea|
00000720  6d 2c 20 69 6e 63 6c 75  73 69 6f 6e 20 6f 66 20  |m, inclusion of |
00000730  5c 78 30 30 20 74 79 70  65 20 65 73 63 61 70 65  |\x00 type escape|
00000740  20 73 65 71 75 65 6e 63  65 73 2c 20 70 61 75 73  | sequences, paus|
00000750  65 20 64 65 6c 61 79 73  2c 0a 74 69 6d 65 6f 75  |e delays,.timeou|
00000760  74 73 20 61 6e 64 20 65  6d 62 65 64 20 74 65 72  |ts and embed ter|
00000770  6d 69 6e 61 6c 20 73 77  69 74 63 68 20 63 6f 6d  |minal switch com|
00000780  6d 61 6e 64 73 20 69 6e  20 73 65 6e 64 20 73 74  |mands in send st|
00000790  72 69 6e 67 73 2c 20 65  67 20 66 6f 72 0a 73 77  |rings, eg for.sw|
000007a0  69 74 63 68 69 6e 67 20  61 20 73 70 6f 6f 6c 20  |itching a spool |
000007b0  6f 6e 2f 6f 66 66 2e 0a  0a 2d 2d 2d 0a 0a 2a 20  |on/off...---..* |
000007c0  41 20 6e 6f 74 65 20 61  62 6f 75 74 20 21 54 43  |A note about !TC|
000007d0  50 49 50 20 63 6f 6d 6d  61 6e 64 20 70 61 72 73  |PIP command pars|
000007e0  69 6e 67 3a 20 4f 6c 64  65 72 20 76 65 72 73 69  |ing: Older versi|
000007f0  6f 6e 73 20 6f 66 20 21  54 43 50 49 50 20 63 6f  |ons of !TCPIP co|
00000800  75 6c 64 0a 20 20 61 63  63 65 70 74 20 75 70 74  |uld.  accept upt|
00000810  6f 20 31 30 20 73 65 70  61 72 61 74 65 20 74 6f  |o 10 separate to|
00000820  6b 65 6e 73 20 70 65 72  20 63 6f 6d 6d 61 6e 64  |kens per command|
00000830  2e 20 49 20 61 6d 20 6e  6f 74 20 73 75 72 65 20  |. I am not sure |
00000840  77 68 61 74 20 6d 61 78  69 6d 75 6d 0a 20 20 63  |what maximum.  c|
00000850  6f 6d 6d 61 6e 64 20 6c  65 6e 67 74 68 20 77 61  |ommand length wa|
00000860  73 20 61 63 63 65 70 74  61 62 6c 65 2c 20 74 68  |s acceptable, th|
00000870  6f 75 67 68 20 49 20 74  68 69 6e 6b 20 69 74 20  |ough I think it |
00000880  77 61 73 20 38 30 20 6f  72 20 63 68 61 72 63 74  |was 80 or charct|
00000890  65 72 73 0a 20 20 69 6e  63 6c 75 64 69 6e 67 20  |ers.  including |
000008a0  65 6e 64 20 6f 66 20 6c  69 6e 65 20 61 6e 64 20  |end of line and |
000008b0  73 74 72 69 6e 67 20 74  65 72 6d 69 6e 61 74 6f  |string terminato|
000008c0  72 2e 0a 0a 20 20 49 6e  20 6f 72 64 65 72 20 74  |r...  In order t|
000008d0  6f 20 63 6f 70 65 20 77  69 74 68 20 74 65 72 6d  |o cope with term|
000008e0  69 6e 61 6c 20 73 77 69  74 63 68 20 74 6f 6b 65  |inal switch toke|
000008f0  6e 73 2c 20 6e 65 74 2c  20 74 65 72 6d 69 6e 61  |ns, net, termina|
00000900  6c 20 61 6e 64 20 63 68  61 74 0a 20 20 63 6f 6d  |l and chat.  com|
00000910  6d 61 6e 64 20 73 65 70  61 72 61 74 6f 72 73 2c  |mand separators,|
00000920  20 63 68 61 74 20 73 74  72 69 6e 67 73 20 65 74  | chat strings et|
00000930  63 2c 20 74 68 65 20 6d  61 78 69 6d 75 6d 20 6e  |c, the maximum n|
00000940  75 6d 62 65 72 20 6f 66  20 74 6f 6b 65 6e 73 20  |umber of tokens |
00000950  68 61 73 0a 20 20 6e 6f  77 20 62 65 65 6e 20 69  |has.  now been i|
00000960  6e 63 72 65 61 73 65 64  20 74 6f 20 36 34 2c 20  |ncreased to 64, |
00000970  61 6e 64 20 74 68 65 20  63 6f 6d 6d 61 6e 64 20  |and the command |
00000980  6c 69 6e 65 20 6c 65 6e  67 74 68 20 69 6e 20 74  |line length in t|
00000990  68 65 20 63 6f 6d 6d 61  6e 64 0a 20 20 62 6f 78  |he command.  box|
000009a0  20 61 74 20 74 68 65 20  74 6f 70 20 6f 66 20 74  | at the top of t|
000009b0  65 72 6d 69 6e 61 6c 20  77 69 6e 64 6f 77 73 20  |erminal windows |
000009c0  69 73 20 6e 6f 77 20 31  30 32 30 20 63 68 61 72  |is now 1020 char|
000009d0  61 63 74 65 72 73 20 28  61 6c 6c 6f 77 69 6e 67  |acters (allowing|
000009e0  20 66 6f 72 0a 20 20 22  5c 72 5c 6e 5c 30 22 20  | for.  "\r\n\0" |
000009f0  74 6f 20 62 65 20 61 70  70 65 6e 64 65 64 2e 0a  |to be appended..|
00000a00  20 20 0a 20 20 4d 61 78  69 6d 75 6d 20 69 6e 2d  |  .  Maximum in-|
00000a10  77 69 6e 64 6f 77 2c 20  28 69 65 20 61 74 20 74  |window, (ie at t|
00000a20  68 65 20 70 72 6f 6d 70  74 29 20 63 6f 6d 6d 61  |he prompt) comma|
00000a30  6e 64 20 6c 69 6e 65 20  6c 65 6e 67 74 68 20 69  |nd line length i|
00000a40  73 20 66 72 6f 6d 20 74  68 65 0a 20 20 70 72 6f  |s from the.  pro|
00000a50  6d 70 74 20 74 6f 20 74  68 65 20 65 6e 64 20 6f  |mpt to the end o|
00000a60  66 20 74 68 65 20 6c 69  6e 65 2c 20 69 65 20 76  |f the line, ie v|
00000a70  61 72 69 61 62 6c 65 2e  0a 0a                    |ariable...|
00000a7a