Skip to content

A Simple NetCat Program

Thomas Cherryhomes edited this page Oct 28, 2020 · 9 revisions

To help get started, we've provided a simple netcat 'nc' like program that echoes received data, and sends keypresses to the specified host.

Atari BASIC

The BASIC version uses the N: handler, and thus is very compact and easy to understand. It is described in detail in this video: https://www.youtube.com/watch?v=LxT6w9JHfKk

100 OPEN #1,12,3,"N1:TCP://BBS.FOZZTEXX.NET/":OPEN #2,4,0,"K:"
101 TRAP 140
110 IF PEEK(764)<>255 THEN GET #2,K:PUT #1,K:XIO 15,#1,12,3,"N:"
120 STATUS #1,A:BW=PEEK(747)*256+PEEK(746):IF BW=0 THEN 110
130 FOR M=1 TO BW:GET #1,C:PUT #16,C:NEXT M:GOTO 110
140 CLOSE #1:? "DISCONNECTED.":END 

You can load a copy of it by loading "D:DUMBTERM.BAS" from the atari-apps.irata.online/Networking/n-handler/n-handler.atr via TNFS.

Modifying:

  • Change the hostname on line 100.
  • You can set the translation on line 100, 3 = CR/LF, 2 = LF, 1 = CR, 0 = NONE. Also change it on line 110.

C

The C version can be found here: https://github.com/FujiNetWIFI/fujinet-apps/tree/master/netcat/src

It can be compiled with CC65: http://cc65.github.io/

It shows:

Example devicespecs:

N:TCP://BBS.FOZZTEXX.NET/ (trans 3, local echo N)
N:TCP://CAVEMUSH.COM:6116/ (trans 3 local echo Y)
N:TCP://SOUTHERNAMIS.COM/ (trans 0, local echo N)

Any not here?

Do you have an equivalent in other languages to put here, add it!

Clone this wiki locally