plbyrd wrote:
It would be good of there was a timeout for TCPLISTEN.
plbyrd wrote:
It would also be good if there was simply an asynchronous listener instead of a blocking listener. Whenever a connection attempt was made it would call back to the specified line number, such as how Basic on Bails works. This would allow a program to intelligently handle multiple requests and present a message such as "Busy, call back later". Maybe something like this:
TCPASYNCLISTEN 6400, 1000, 2000
Maybe the whole model should move to event driven with callbacks, as per BoB. Rather than a timeout for TCPLISTEN, would you rather instead have something like :
10 ONTIMER 60,1000 : REM call line 1000 every 60 seconds
20 BINDTCP 6464,2000,3000,4000: REM listen on tcp port 6464 - this call would never return, rather 2000 is called after a connection is made, 3000 is called whenever new data arrives, 4000 is called when a session is dropped.
There would also be a BINDUDP option, which (since UDP is sessionless) would only take a port number and a line to call whenever a packet arrives.
Some questions:
1) If I did this, should I retain the procedural model (TCPLISTEN/POLL) or replace it ?
2) Would this be better done as an extension of BoB rather than Kipper BASIC?
3) Should I add an "ONKEY" event as well (when a key is pressed on the local machine)?
4) Any other significant events?
Unfortunately, I don't see being able to add the ability to specify a line number to call for a 2nd (or subsequent) simultaneous connection in the near future - I took a bunch of shortcuts when I added TCP to ip65 (which BoB & KB are built on) that mean adding support for multiple sessions (even if they are only help open long enough to say "CALL BACK LATER") will be hard work.