1 ## Application 2 3 TCPSER turns a PC serial port into an emulated Hayes compatible modem that 4 uses TCP/IP for incoming and outgoing connections. It can be used to allow 5 older applications and systems designed for modem use to operate on the 6 Internet. TCPSER supports all standard Hayes commands, and understands 7 extended and vendor proprietary commands (though it does not implement 8 many of them). TCPSER can be used for both inbound and outbound connections. 9 10 ## License 11 12 TCPSER is distributed under the GPL 2.0 or later 13 14 ## Installation 15 16 ### macOS 17 18 Install with [Homebrew](https://brew.sh/) by 19 20 ``` 21 brew tap rickard-von-essen/formulae 22 brew install tcpser 23 ``` 24 25 ## Executable/Building 26 27 Simply clone the repository and use the appropriate make command to generate the executable. If unsure, try the default make command first. 28 29 | OS | Command | 30 | ------------------- | -------------------------- | 31 | Default/Linux/macOS | `make` | 32 | Solaris | `make -f Makefile.solaris` | 33 | *BSD | `gmake` | 34 | Windows | `make` | 35 36 The application archive contains a pregenerated Windows 32 bit executable 37 (tcpser.exe). No compilation should be required, though the GNU toolchain and 38 the CYGWIN POSIX libraries can be used to regenerate the executable if desired: 39 40 Note that at least the cygwin1.dll library is required to operate tcpser under 41 Windows. I recommend downloading a recent version from www.cygwin.com 42 43 ## Operation 44 ``` 45 tcpser -d -s -l -t ... 46 ``` 47 -or- 48 49 ``` 50 tcpser -v -s -l -t ... 51 ``` 52 ## Examples 53 ``` 54 tcpser -d /dev/ttyS0 -s 38400 -l 7 -tsSiI -i "s0=1" -p 6400 55 ``` 56 Will start tcpser on ttyS0 at 38400 bps, level 7 logging, tracing of 57 inbound serial, outbound serial, inbound IP, outbound IP, init 58 modem to answer after 1 ring, and listen for incoming connections on port 59 6400 60 61 ``` 62 tcpser -v 25232 -s 38400 -l 4 -p 23 63 ``` 64 Will set up an ip232 port at 25232, report 38400 bps connections, 65 level 4 logging, and listen for incoming connections on port 23. 66 67 tcpser -h will provide additional information 68 69 tcpser can be configured to send the contents of a file upon: 70 71 | Event | Flags | 72 |--------------------|-------| 73 | connect | -c -C | 74 | answer | -a -A | 75 | no-answer | -I | 76 | busy | -B | 77 | inactivity-timeout | -T | 78 79 For connect and answer, there are separate options for sending a file to the 80 local serial connection (-c, -a) and the remote IP connection (-C, -A). 81 82 If tcpser connects to a telnet service, it will negotiate the connection 83 using the telnet protocol. If telnet is detected, then tcpser will support 84 RFC 856 (Telnet Binary Transmission), so that 8-bit file transfers will 85 work correctly. 86 87 tcpser can be configured to support multiple serial/ip232 ports on one TCP/IP 88 port. Simply repeat the -s and -d/-v parameters on the command line for each 89 serial/ip232 port to be configured. Options s,S,a,A,c,C,I, and T will 90 "propagate" to subsequent connections, unless they are redefined. Defaults 91 for s and S are 38400. This configuration enables the operation of a 92 multi-line BBS on one TCP/IP port. 93 94 Frequently used addresses can be configured in the "phonebook", like so: 95 ``` 96 tcpser .... -nhome=jbrain.com:6400 97 ``` 98 This is also useful for systems that do not accept non-numeric phone numbers: 99 ``` 100 tcpser .... -n9169651701=bbs.fozztexx.com 101 ``` 102 One can even "hide" a regular IP address or DNS entry by aliasing it to 103 something else: 104 ``` 105 tcpser .... -njbrain.com=bestbbs.com 106 ``` 107 At this point, phonebook support is very alpha, so use with care. 108 109 ## Emulation 110 111 All of the standard Hayes commands should behave as expected. Some of 112 of the proprietary commands are not implemented, but should not cause 113 errors. 114 115 Examples: 116 117 | Command | Effect | 118 |---------------------|----------------------------------------------------| 119 | ats0=1 | set number of rings to answer | 120 | ata | answer the line | 121 | ath0 | hang up | 122 | ats12? | query S register 12 | 123 | ate0 | turn off echo | 124 | at&k3 | set flow control to RTS/CTS | 125 | atdtjbrain.com:6400 | "dial" jbrain.com, port 6400 (defaults to port 23) | 126 | atdl | "dial" last number | 127 | a/ | repeat last command | 128 129 Commands can be chained, as on a regular modem: 130 ``` 131 ats0=1z&c1&k3%f0s3=13dtjbrain.com 132 ``` 133 tcpser supports the Hayes break sequence semantics, so +++ should operate 134 correctly, even if the sequence of characters is used in normal data 135 transmissions.i 136 137 ## Cable 138 139 tcpser can be used with a regular null modem cable, but it utilizes the DTR 140 line on the PC serial port to reflect the state of the DCD line as seen by the 141 target system. On a normal null-modem cable, DTR is mapped to DCD/DSR, which 142 implies DSR will also reflect the state of DCD on the target machine. However, 143 some systems (notably those utilizing the 6551 ACIA communication IC) will not 144 transmit unless DSR is held high. In this case, a quick qorkaround is to force 145 DCD to be held high by adding -i"&c0" to the tcpser parameter list. However, 146 this also prevents normal operation of the DCD line, which is needed by some 147 BBS systems. A more permanent solution is to construct a modified null-modem 148 cable or modify an existing cable to the following specifications: 149 150 PC Target 151 152 CTS-----RTS 153 RTS-----CTS 154 SND-----RCV 155 RCV-----SND 156 157 DTR-----DCD 158 159 DCD-+-+-DTR 160 | | 161 DSR-+ +-DSR 162 163 GND-----GND 164 165 This differs from a regular null-modem cable in that the target machine has DSR 166 looped to DTR, not to DCD. Note that this cable is directional. 167 168 Normally, the target machine will configure DSR to float to a high state if 169 unconnected. As well, PCs do not require a valid DSR line for operation. Thus, 170 a simpler cable can be constructed that is bi-directional: 171 172 CTS-----RTS 173 RTS-----CTS 174 SND-----RCV 175 RCV-----SND 176 DTR-----DCD 177 DCD-----DTR 178 GND-----GND 179 180 Unless there are issues, we recommend this simplified version, as it can be 181 installed in either direction. 182 183 As an even simpler solution, many have simply taken a normal rs232 DE-9F to 184 DE-9M cable and removed pin 6 from the male end (DSR). This is fine, but the 185 cable must be installed between the null modem adapter and the target machine: 186 187 PC ----- null-modem adapter ----- cable with pin 6 removed ------ target machine 188 189 Any other configuration will not work correctly. 190 191 ## Platform notes 192 193 Win32 users should use /dev/ttyS0-3 for COM1-4. At present, using "com1:" 194 does not operate correctly. 195 196 Raymond Day sends the following Ubuntu 7.10 autorun scripts: 197 198 In: 199 200 /etc/init.d/ 201 202 Make a file named something like tcpser with this code in it: 203 ``` 204 #!/bin/sh 205 # Start tcpser at 1200 boud on both RS232 ports for Q-Link Reloaded. 206 case "$1" in 207 'start') 208 tcpser -d /dev/ttyS0 -s 1200 -i"e0&k0&c0" -n"5551212"=66.135.39.36:5190& 209 tcpser -d /dev/ttyS1 -p 6401 -s 1200 -i"e0&k0&c0" -n"5551212"=66.135.39.36:5190& 210 ;; 211 'stop') 212 ;; 213 *) 214 echo "Usage: $0 { start | stop }" 215 ;; 216 esac 217 exit 0 218 ``` 219 ## Help 220 221 tcpser has a small but active user community. Help can be found by asking a 222 question in comp.sys.cbm, on the NEWNet #c64friends IRC channel, or by emailing 223 the author. 224 225 --- 226 227 Jim Brain 228 tcpser@jbrain.com 229 www.jbrain.com 230 231 Thanks: 232 233 - The ip232 support was added by Anthony Tolle. 234 - Telnet support fixes were added by Gene Buckle (geneb): https://github.com/geneb/tcpser 235 - Automatic modem parity detection and numerous fixes were added by Chris Osborn (fozztexx): https://github.com/FozzTexx/tcpser 236 237