| Author |
sending an instance of a class thru a socket
|
Preetham M
Greenhorn
Joined: Sep 18, 2002
Posts: 12
|
|
Hi All: I have a fundamental question on sending data thru sockets. I have a class, class A { int a; int b;} I have created an object where i have initialised it to some specific values in my main class. I would now like to send this data to another socket. can i send the contents of the class as a single unit, or must i break it down n send it byte by byte. I am currently using out.write()to send data. Would appreciate the help. Thanks, Preetham.
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
You can use serialization to send objects through any form of stream. Search for the serialization tutorial at java.sun.com
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Preetham M
Greenhorn
Joined: Sep 18, 2002
Posts: 12
|
|
|
thanx..found it.
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Preetham M, We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. Thanks Pardner! Hope to see you 'round the Ranch!
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: sending an instance of a class thru a socket
|
|
|