sending classe or struct with socket!
-
hi, I am a new socket programmer, I know that socket allow sending buffer of char by send(), if I wont to send a struct or whole class, how I do it? thanks.
You'd probably get a lot more responses if you posted this in the C++ message board :)
"Isn't that the "write once, debug everywhere" language?" Tom Archer on Java... :)
-
hi, I am a new socket programmer, I know that socket allow sending buffer of char by send(), if I wont to send a struct or whole class, how I do it? thanks.
I don't know if there's a simple way to send an object over sockets,but u may want to send the individual data members and reconstruct the object on the receiving end.
-
hi, I am a new socket programmer, I know that socket allow sending buffer of char by send(), if I wont to send a struct or whole class, how I do it? thanks.
You may send whole struct, just as byte buffer. With class, You will have a problem, cause it is impossible to get object instance address and send sizeof(class_type) bytes (or maybe - it is possible but won't work). In such case, send class identification (what class is this ; some define, etc) and all the data which are required to fully recreate class instance on the other side. Mukkie