AppleWin icon indicating copy to clipboard operation
AppleWin copied to clipboard

Support SSC/serial port's TCP mode connecting to a remote server

Open blindphoneman opened this issue 3 years ago • 10 comments

Hi:

I just thought of something that might be a neat feature, similar to one you already have in the program.

I also use a program called DOSBox-X (a branch of the original DOSBox). One of the options for setting a serial port is similar to your TCP option, but, with an added twist.

What if the TCP option could be augmented so that it could act like a modem, accepting AT commands, and allowing an outgoing raw telnet connection to any address, e.g. "ATDTprokeggs.ksherlock.com:6523" would connect the coms program user with the Pro-Keggs telnet BBS on port 6523 at prokeggs.ksherlock.com. By default, port 23 could be used unless the colon and port number were present. . It might be possible to even have "phonebook" entries, in case the coms software didn't like addresses. AppleWin could even listen on a designated incoming port and "ring" so that someone could telnet into a BBS running on AppleWin.

Probably something a ways down the road, but, thought I'd mention it.

Thanks!

blindphoneman avatar Jun 24 '21 22:06 blindphoneman

KEGS/GSport (and GSPlus, if it's kept the code) has this kind of outgoing modem emulation. In fact I added the :port modifier to GSport as a suggestion from Andrew Roughan.

Cheers, Nick.

sicklittlemonkey avatar Jun 24 '21 22:06 sicklittlemonkey

I tried it on GSPlus and it seems to work ok under Windows in certain circumstances.  I can’t get the thing to handle dsr/dtr, but, that might be a setting in control panel or something. Is there a way to make it use a real comport?  That way, I can do the same thing I usually do with AppleWin, run tcpser. This is not a show stopper, just a thought. Thanks! 

blindphoneman avatar Jun 25 '21 15:06 blindphoneman

I think the original KEGS code only used TCP, not a real serial port, but I can't check right now sorry.

sicklittlemonkey avatar Jun 26 '21 05:06 sicklittlemonkey

KEGS/GSport (and GSPlus, if it's kept the code) has this kind of outgoing modem emulation. In fact I added the :port modifier to GSport as a suggestion from Andrew Roughan. Cheers, Nick.

I hadn't heard of these, so I just downloaded them. Chrome wanted to block GSPlus from downloading, and VirusTotal.com had 3 hits on gsplusmanual.pdf, all calling it a PDF trojan.

philgoetz avatar Jul 21 '21 18:07 philgoetz

It's depressing how many false positives antivirus has to get in order to catch the actual bad stuff. ; - )

sicklittlemonkey avatar Jul 22 '21 00:07 sicklittlemonkey

It's depressing how many false positives antivirus has to get in order to catch the actual bad stuff. ; - )

I do get a lot of false positives now from the community-contributed rules for detecting ransomware, but I don't know that I've ever gotten a false positive for a PDF trojan in the course of scanning over 100,000 PDFs from many diverse sources. This file has 3 positives for a PDF trojan.

philgoetz avatar Jul 22 '21 06:07 philgoetz

Hi Nick,

IIUC, AppleWin's TCP-serial support acts as a server - so listens & accepts connections on a socket (port=1977). The change here is that we'd also support AppleWin connecting to a server (eg. prokeggs.ksherlock.com:6523).

tomcw avatar Jul 25 '21 11:07 tomcw

Yes, it was so long ago I almost forget. But you're right, it's listening.

For this you'd want an outgoing connection, but also state to know whether to interpret AT commands or just send & receive until the connection is terminated (but handle escapes!).

Cheers, Nick.

sicklittlemonkey avatar Jul 25 '21 12:07 sicklittlemonkey

Hi Nick - I can see your commits to GSport here: https://github.com/david-schmidt/gsport/commits/master/src/scc_socket_driver.c

From the GSport docs:

You may use the SCC ports as either a LocalTalk networking connection or as traditional serial ports. GSport emulates the two serial ports on a IIgs as being two Unix sockets. Port 1 (printer port) is at socket address 6501, and port 2 (modem) is at socket address 6502.

By default, slot 1 is emulated using a simple receive socket, and slot 2 emulates a Virtual Modem.

A Virtual Modem means GSport acts as if a modem is on the serial port allowing Apple II communcation programs to fully work, but connected to internet-enabled sockets. GSport emulates a "Hayes- Compatible" modem, meaning it accepts "AT" commands. You can use GSport to connect to free telnet-BBSs, or run a BBS program on GSport and become a telnet BBS yourself.

So AppleWin would also need emulation for a "Hayes- Compatible" modem, ie. the AT commands (and specifically ATDT command mentioned above).

tomcw avatar Jul 25 '21 14:07 tomcw

Yeah, it's all in that file. If you do a find for "AT you will get to the switch statement that handles the AT commands.

The code is a bit tricky to understand though because it's strewn with checking of state variables. It would be much nicer to have a separate class with methods for manipulating the state to replace this stuff:

	scc_ptr->state = 1;		/* successful socket */
	scc_ptr->sockfd = -1;		/* Indicate no socket open yet */
	scc_ptr->accfd = -1;		/* Indicate no socket open yet */
	scc_ptr->rdwrfd = -1;		/* Indicate no socket open yet */
	scc_ptr->socket_state = -2;	/* 0 means talk to "modem" */
					/* 1 connected */
	scc_ptr->socket_num_rings = 0;
	scc_ptr->socket_last_ring_dcycs = 0;
	scc_ptr->dcd = 0;		/* 0 means no carrier */

sicklittlemonkey avatar Jul 25 '21 23:07 sicklittlemonkey