That is how I do it with my commercial game server however I am shifting to using xml as the structure where you can still use the sockets and the write and read but the packets are xml for better error checking. The current way I do it leaves a mess at the receiving end and you can't make its o someone can easily write a client for your game if you want that ability with pure binary. I mean sure you can tell the person read 8 bites for this and 9 for that but it's much easier if they can use an xml parser to get your data. Not only that but it's easier for you to up keep in the long run which is why xml structures are becoming the norm. All the boost library does that I suggested is packet he data into a xml structure from a class or a structure with no work then you send it by horse, space ship or pipe to the distant end and use the same boost to unpack it. Its fast and takes no work from the coder. Not only that but as Tialor wants its open source for that matter I think it's all c++ headers at least most of the library is just headers. Ken Ken Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Sina Bahram Sent: Wednesday, June 03, 2009 8:39 PM To: programmingblind@xxxxxxxxxxxxx Subject: RE: network programming On the other hand, if you're dealing with actual packets, you might want to just use the write command and write the binary structure to the socket. Take care, Sina -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry Sent: Wednesday, June 03, 2009 7:14 PM To: programmingblind@xxxxxxxxxxxxx Subject: RE: network programming Me I would use boost library and the serialize class that makes it simple to turn a structure or class into an xml structure and extract it on the other end. Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler Littlefield Sent: Wednesday, June 03, 2009 12:37 PM To: programmingblind@xxxxxxxxxxxxx Subject: network programming Hello list, I've got a question. I've been working on a program, and I have a document that explains the protocol and how things work. It's about 20 pages so far, but it'll probably get revised to be shorter once I start doing the actual work and seeing whether things will work. My question is this: I'm working with a structure that looks something like: struct packet { MessageType mtype; int DataLength; char* data; }; How would I go about serializing that so that it'll go across the stream? I'll need to memcpy the data I'm thinking, no? I'm also looking at encryption; I need to find some sort of way to let the client encrypt with the host, without a predefined key; the only way I can think of is for the host to build a random key, but then it'd have to send it cleartext to the client, which is rather counterproductive. Thanks, Tyler Littlefield Web: tysdomain.com email: tyler@xxxxxxxxxxxxx My programs don't have bugs, they're called randomly added features. __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind