Thread overview
Sending own class as binary data over socket
Jan 22, 2007
Masterchief
Jan 22, 2007
Brecht Machiels
Jan 22, 2007
Bertel Brander
Jan 23, 2007
Masterchief
Jan 24, 2007
Pavel Vozenilek
January 22, 2007
Hy!

I am trying to develop a Client Server Communication over TCP/IP.
I want to use an own Message class and send this class as binary data over a
socket.
I want to use stream operators for reading and writing to the stream.

How do I convert a class to binary data to send it?
How do I use a socket and stream operators for reading and writing?

Thanks a lot.

Examples would help a lot:-)

Ronny


January 22, 2007
Hello,

you might want to look into the CORBA framework for the passing of objects. Using this framework you will not have to worry about socket programming.

There should be plenty of documentation on socket programming on the net. A good book might be better though.

Regards,
Brecht

Masterchief wrote:
> Hy!
> 
> I am trying to develop a Client Server Communication over TCP/IP.
> I want to use an own Message class and send this class as binary data over a socket.
> I want to use stream operators for reading and writing to the stream.
> 
> How do I convert a class to binary data to send it?
> How do I use a socket and stream operators for reading and writing?
> 
> Thanks a lot.
> 
> Examples would help a lot:-)
> 
> Ronny 
> 
> 
January 22, 2007
Masterchief skrev:
> Hy!
> 
> I am trying to develop a Client Server Communication over TCP/IP.
> I want to use an own Message class and send this class as binary data over a socket.
> I want to use stream operators for reading and writing to the stream.
> 
> How do I convert a class to binary data to send it?
> How do I use a socket and stream operators for reading and writing?
> 
> Thanks a lot.
> 
> Examples would help a lot:-)

I have some code that could be used as a start, but I have to
adjust it to Digital Mars.

There are some questions:
Do you have full control of both ends of the socket?
Do both ends use the same hardware and compiler?
Do the classes that is to be send use virtual methods?
Do the classes have pointers to data, or is it only
POD and arrays?

-- 
Just another homepage:
http://damb.dk
But it's mine - Bertel
January 23, 2007
Hy!

> There are some questions:
> Do you have full control of both ends of the socket?
Yes
> Do both ends use the same hardware and compiler?
Yes
> Do the classes that is to be send use virtual methods?
NO
> Do the classes have pointers to data, or is it only POD and arrays?
I think I will just use arrays.

The code would be very helpfull.

Thanks a lot.

"Bertel Brander" <bertel@post4.tele.dk> schrieb im Newsbeitrag news:ep33ni$13p1$1@digitaldaemon.com...
> Masterchief skrev:
>> Hy!
>>
>> I am trying to develop a Client Server Communication over TCP/IP.
>> I want to use an own Message class and send this class as binary data
>> over a socket.
>> I want to use stream operators for reading and writing to the stream.
>>
>> How do I convert a class to binary data to send it?
>> How do I use a socket and stream operators for reading and writing?
>>
>> Thanks a lot.
>>
>> Examples would help a lot:-)
>
> I have some code that could be used as a start, but I have to adjust it to Digital Mars.
>
> There are some questions:
> Do you have full control of both ends of the socket?
> Do both ends use the same hardware and compiler?
> Do the classes that is to be send use virtual methods?
> Do the classes have pointers to data, or is it only
> POD and arrays?
>
> -- 
> Just another homepage:
> http://damb.dk
> But it's mine - Bertel


January 24, 2007
"Masterchief" wrote:

> I am trying to develop a Client Server Communication over TCP/IP.
> I want to use an own Message class and send this class as binary data over
> a socket.
> I want to use stream operators for reading and writing to the stream.
>
> How do I convert a class to binary data to send it?
> How do I use a socket and stream operators for reading and writing?
>

On http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
is a tool to serialize any C++ class and send it over the wire.

Once DMC will be able to deal with Boost this library should work as well.

IMHO DMC has a good chance to reach this state,
based on the feedback for bug reports.

/Pavel