Network library data transfer question

I recently started working with the processing network library, and when it comes to data transfer between a server and clients, I don’t see a good way to do it.

I managed to transfer data reliable using Strings, but if for example I send 4 different Strings (“X16”, “Y32”, “Z48”, “W64”), I recieve them as one long string (“X16Y32Z48W64”).

It is not a problem, but I do not like decoding Strings to get the data in the correct place and moment.

The question is if there is a better or cleaner way to transfer the data that is easier to manage and mantain.


You can have a look at the examples provided by the oscP5 library for an alternative. You can attach different data types to a message. The only rule is that you need to extract those data types in the same order and you will be fine. In general, you decide how to transfer the data. Decoding the data is not a big deal. In server-client page delivery, this is referred as parsing the received data and it is very common. In certain sites it could account for a third of the time a client takes to process the data. In a nutshell, parsing is done based on the data that you transfer. If you want to stick to a format, you can follow json as it is a structure that seems to be standard in many platform nowadays…