Value to udp in gamma

hello, i have a simple gamma question, how can i convert a value so i can send in via udp in gamma.

many greetings

think the udp node needs strings. just convert with ToString. suppose you seen the udp help patch too?

@tgd no, the node takes a byte array

hey jens, it depends on what value and how you want to send it, ie what the receiver expects. can you tell us about the receiver?

@joreg yes i know but had the feeling the question is about sending a value but ToBytes does only accept string. hence the question if he is working with the help patch.


Make yourself this 2 nodes and thats it

My bad, I think this is what he is asking

what @andresc4 is showing first, is how to build custom nodes around UdpClient/Server (he calls UdpSender/Listener) that work specifically with strings. this may be what OP asks for or not. either way it looks a bit scary to me as an answer.

the next thing he shows doesn’t really make sense. why use PrefixLength here? this node is only usefuly in connection with stream-based protocols like Serial or TCP, to provide a form of message framing. this is not needed with UDP.

before we can answer the question, we need to hear what exactly needs to be sent and how the receiver is expecting to receive it.

I was thinking out loud… looking for a way to convert values to bytes, a simple GetIn16Bytes can work also, not sure how to create just 1 byte

@andresc4 needed the same thing today for something different, but there is the toByte node when you activate lowlevel nodes and we also did use the prefixlength node at first to achieve the goal of one byte only

to send a single byte, you’d use FromValue [Collections.Spread] like so:
using the PrefixLength node actually sends 2 bytes, and as mentioned is only useful for tcp and serial communication

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