TCPServer: how do I get the data?

Hello vvvvriends,

I recently switched to gamma, love the new “everything”, (especially the zoming function while patching) but get more and more frustrated because:

I can’t find out how to get the (string) data received by IO.TCP’s TCPServer.

In beta, received strings are available through TCP (Network Server String)/Output.
In gamma, I tried TCP [IO.TCP] (available after Manage Nugets/Commandline - nuget install vl.io.tcp -pre), but I can’t find out where the received strings are available. (With network tool “wireshark” I see the packets with the strings are received by the server.)

While the TCPClient has the SendString companion for sending strings, the TCPServer doesn’t seem to have a buddy like this.

What did I miss?

hey oliver, good point. a simple way to receive strings is indeed missing. so far you’d have to know a bit more about how to tokenize the received bytes and convert them to string…

i’ll see what i can do about this and let you know when the pack is updated…

Hello joreg,

absolutely impressive your high speed response. Thank you!

Ok, I’m relieved a little because I didn’t miss the string receiver because I’d be short minded but rather because it doesn’t exist (yet).

You mean I can indeed process the received strings (until the package gets the proper update) utilizing a tokenizer? Would help.

Thanks again! Cheers,

Oliver

please update your nuget by again running:

 nuget install vl.io.tcp -pre

this should give you version 0.2.1-alpha which now has a convenience ReadStringUntil node. See the help Overview of how it is used.

Excellent! Like a gift. What a superfast fix!

Besides of doing something for living, I played with that new node ReadStringUntil and I’m not where I was with beta yet.
After data passes ReadStringUntil and S+H into IOBox, I only see the last line of the received multiline string.
A hint how to keep the whole string (with many “\n\r”) would be highly appreciated. (Can ReadStringUntil read until EOF/EOT?)

ReadStringsUntil on the other hand gives an Observable <Spread>. How do I convert this into a single string.

(The string is actually an xml file).

yes, that is exactly what it does. it is a convenience node for cases where you’re receiving data continuously and where it is OK to only always get the last string.

it reads until whatever character (or combination of characters) you specify in the “Terminator” input. and then obviously you also need to add that character at the end of your xml string. so add an EOT at the end of the string you send and specify it in the Terminator input and you should be good.

to specify non-printable terminators, use the FromBytes node:

grafik

Phantasic!
Works wonderfully. The until-condition (“end of submitted string”) is now “</PassengerDoorCountDelivery>” and when I concat the resulting string with “</PassengerDoorCountDelivery>” again then I got the original string that was sent.
The string is an ITxPT message in xml.

Thank you, joreg, for your support. That helps me making vvvv/VL my personal multipurpose toolkit (want to use it for everything.)

well, this is a bit unorthodox, but if it works for you, good!

good to hear!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.