Posted By: Kartoffel
send custom data - 05/27/13 15:01
Hey there,
I'd like to send custom data (by using a struct and send_data_to)
I thought about something like this:
Let's say I want to send an image.
I would set mp_data.size to the size of the image and copy the image into mp_data.data.
This should make it possible to use memcpy after receiving it.
...but that's just the theory and I have no idea how I shoud code this
Could anyone give me a simple, working code example (if it's not too much work, of course)?
Sending and receiving a string with this method would already be enough.
regards, Kartoffel
I'd like to send custom data (by using a struct and send_data_to)
I thought about something like this:
Code:
typedef struct MP_DATA { var size; // size of 'data' int type; // what does 'data' contain void * data; // data } MP_DATA;
Let's say I want to send an image.
I would set mp_data.size to the size of the image and copy the image into mp_data.data.
This should make it possible to use memcpy after receiving it.
...but that's just the theory and I have no idea how I shoud code this
Could anyone give me a simple, working code example (if it's not too much work, of course)?
Sending and receiving a string with this method would already be enough.
regards, Kartoffel