Hugh Hood
2023-12-25 00:48:16 UTC
Ever since Kent added his serial client to IP server feature to KEGS in
v1.29, I've been primarily using it to print directly and swiftly from
Apple II applications to a network printer attached to the host on which
KEGS is running. It works very, very well for that, in both 8-bit and
GS/OS applications.
I've also wanted to use that feature to connect from ProTERM and/or
Spectrum to the terminal app in MacOS, and to the command line console
in Windows 10. Notwithstanding that most would not find that useful, I
must say that I've tried it on both platforms and it is indeed possible.
On MacOS, I just followed Blake Patterson's method of using 'socat'
within a daemon.
<https://bytecellar.com/2022/11/28/configure-your-mac-to-allow-vintage-computers-to-dial-in/>
His method uses the login command automatically, and other than
installing socat and adding a .plist file to /Library/launchdaemons
there really isn't much to it.
On Windows 10, I've been using a little different method, but it also
involves socat and a couple of .bat files.
One .bat file summons socat to accept a connection from the Apple II and
then forwards it to the Windows command line.
Since I wasn't happy with there not being a prompt for login (and I
wasn't satisfied with the 'runas' method, the second .bat file, which
socat 'EXEC's, provides login prompts and verification, and assuming one
passes, starts up 'cmd.exe'.
I've tested it in both ProTERM 3.1 and also in Spectrum and it does the
job well. In both, I ran with VT100 emulation and with the baud rate set
to 57,600. I'm not sure the Windows console even uses VT100, but that
setting seemed to provide the best visual results in ProTERM and
Spectrum, for whatever reason.
Script #1 is basically just one line:
************************************************************************
socat.exe TCP4-LISTEN:7778,fork
EXEC:"C\:\/Users\/yourusername\/Desktop\/userandpwprompt.bat",pty,setsid,setpgid,stderr
************************************************************************
For example purposes, I left in the path to Script #2 just to show you
how socat requires the ":" and "\" in Windows pathnames to be escaped.
And yes, the Windows slashes are reversed, but that is what works with
socat.
Script #2 (which I called 'userandpwprompt') is several lines:
************************************************************************
@Echo Off
:Top
@set INPUT=
@set /P INPUT="Username: "%=%
@if /i NOT "%INPUT%" == "***@yourdomain.com" cls & timeout /t 0
/nobreak & goto Top
@set INPUTPW=
@set /P INPUTPW="Password: "%=%
@if /i NOT "%INPUTPW%" == "yourpassword" cls & timeout /t 0 /nobreak &
goto Top
@cls
C:\Windows\System32\cmd.exe
************************************************************************
Now, I don't claim to be an accomplished .bat scripter. I'm sure this
could be improved, but it works.
FWIW, the main reason I require a login is so I don't accidentally send
errant characters to the serial port being forwarded to the socat server.
Anyway, I'm glad that's done. It's been a semi-obsession for several
days now. I can go back to finishing my real work now. ;-)
Hugh Hood
v1.29, I've been primarily using it to print directly and swiftly from
Apple II applications to a network printer attached to the host on which
KEGS is running. It works very, very well for that, in both 8-bit and
GS/OS applications.
I've also wanted to use that feature to connect from ProTERM and/or
Spectrum to the terminal app in MacOS, and to the command line console
in Windows 10. Notwithstanding that most would not find that useful, I
must say that I've tried it on both platforms and it is indeed possible.
On MacOS, I just followed Blake Patterson's method of using 'socat'
within a daemon.
<https://bytecellar.com/2022/11/28/configure-your-mac-to-allow-vintage-computers-to-dial-in/>
His method uses the login command automatically, and other than
installing socat and adding a .plist file to /Library/launchdaemons
there really isn't much to it.
On Windows 10, I've been using a little different method, but it also
involves socat and a couple of .bat files.
One .bat file summons socat to accept a connection from the Apple II and
then forwards it to the Windows command line.
Since I wasn't happy with there not being a prompt for login (and I
wasn't satisfied with the 'runas' method, the second .bat file, which
socat 'EXEC's, provides login prompts and verification, and assuming one
passes, starts up 'cmd.exe'.
I've tested it in both ProTERM 3.1 and also in Spectrum and it does the
job well. In both, I ran with VT100 emulation and with the baud rate set
to 57,600. I'm not sure the Windows console even uses VT100, but that
setting seemed to provide the best visual results in ProTERM and
Spectrum, for whatever reason.
Script #1 is basically just one line:
************************************************************************
socat.exe TCP4-LISTEN:7778,fork
EXEC:"C\:\/Users\/yourusername\/Desktop\/userandpwprompt.bat",pty,setsid,setpgid,stderr
************************************************************************
For example purposes, I left in the path to Script #2 just to show you
how socat requires the ":" and "\" in Windows pathnames to be escaped.
And yes, the Windows slashes are reversed, but that is what works with
socat.
Script #2 (which I called 'userandpwprompt') is several lines:
************************************************************************
@Echo Off
:Top
@set INPUT=
@set /P INPUT="Username: "%=%
@if /i NOT "%INPUT%" == "***@yourdomain.com" cls & timeout /t 0
/nobreak & goto Top
@set INPUTPW=
@set /P INPUTPW="Password: "%=%
@if /i NOT "%INPUTPW%" == "yourpassword" cls & timeout /t 0 /nobreak &
goto Top
@cls
C:\Windows\System32\cmd.exe
************************************************************************
Now, I don't claim to be an accomplished .bat scripter. I'm sure this
could be improved, but it works.
FWIW, the main reason I require a login is so I don't accidentally send
errant characters to the serial port being forwarded to the socat server.
Anyway, I'm glad that's done. It's been a semi-obsession for several
days now. I can go back to finishing my real work now. ;-)
Hugh Hood