Simple connection

From BeebWiki
Revision as of 23:58, 28 August 2013 by WikiSysop (talk | contribs) (1 revision)
Jump to: navigation, search


   DIM ctrl% 15:X%=ctrl%:Y%=X%DIV256
   DIM rxBuf% 1,txBuf% 1:rxNum%=0
   :
   INPUT "Connect to:  "A$:stn%=FNNet_StnNum(A$)
   INPUT "Port number: "port%
   :
   ON ERROR REPORT:PROCNet_RxKill(rxNum%):PRINT:END
   rxNum%=FNNet_RxOpen(stn%,port%,rxBuf%,1)
   REPEAT
     REPEAT
       A%=INKEY(1):IFA%>-1:?txBuf%=A%:A%=FNNet_Tx(stn%,&80,port%,txBuf%,1)
     UNTIL FNNet_Rx(rxNum%)
     A%=FNNet_Read(rxNum%)
     VDU ?rxBuf%:IF?rxBuf%=13:VDU 10
     rxNum%=FNNet_Open(stn%,port%,rxBuf%,1)
   UNTIL FALSE

This code uses the Net library.

Jgharston 22:32, 14 May 2009 (UTC)