Socket C++ | Sololearn: Learn to code for FREE!

+2

Socket C++

I want to write game with lan multiplayer. I use bsd-socket for chat, but I don't know how to pass player class through socket.

12/13/2017 12:10:55 AM

Тимофей Солончук

1 Answer

New Answer

+2

There are many ways, i gonna mention two. 1-easy) put your relevant object information into a bytearray and just send it like you did with the text messages. 2-elegant) pass a reference of your object to send and use sizeof(...) for your length. Take a look into boost alignment stuff if you are interested in this way.