Code archives/Networking/InputTCP$

This code has been declared by its author to be Public Domain code.

Download source code

InputTCP$ by schilcote
(Posted 18 years ago)
I wrote this function for a remote control command line program I was writing. I suddenly realised it workd exactly like the Input command, halting execution until some data comes over input_stream, which it then returns.
Function InputTCP$(input_stream)
Repeat
;no operation because we're just waiting for something to come up on the TCP stream
Until(ReadAvail(input_stream)) 
ret_val$=ReadLine(input_stream)
Return (ret_val$)
End Function

Comments

Ked
(Posted 18 years ago)
This is nothing like the Input command. With the Input command you are able to type something, this just waits for something to arrive on the stream.

TaskMaster
(Posted 18 years ago)
The input command wait for data to arrive via the console.

This function waits for it to arrive via a socket.

It is similar functionality.

Ked
(Posted 18 years ago)
It should be titled WaitTCP, so it isn't so misleading. You aren't doing any inputting, you are just waiting.

BTW, I think the variables are incorrect inside the function. "remote_stream" should be "input_stream".

schilcote
(Posted 18 years ago)
Wow, this is still the most recent piece of networking code!

Code Archives Forum