| Author |
How to send any java Object through socket?
|
Parshuram Walunjkar
Ranch Hand
Joined: Jan 02, 2002
Posts: 31
|
|
Hi Everybody, I want know how to send any java Object through socket i.e. send Object through socket from client side and read it to the server side and vice versa. Please suggest solution me. Regards From Parshuram
|
 |
Les Dsouza
Greenhorn
Joined: Jan 29, 2002
Posts: 27
|
|
To send an object thru a stream you need to serialize it ie.. the object should implement the serializable interface; this is a 'marker' interface hence you dont need to define any methods. All objects that support the java.io.Serializable interface can be written to streams. TO send the object you use an ObjectOutputStream - call its writeObject method, Likewise to read you use the ObjectInputStream's readObject method. Hope the code below helps - [ February 04, 2002: Message edited by: Les Dsouza ] [ February 04, 2002: Message edited by: Les Dsouza ]
|
 |
Parshuram Walunjkar
Ranch Hand
Joined: Jan 02, 2002
Posts: 31
|
|
Hi all, I am sending Object from server to client it receive to the client side but I am doing that hole thing in thread so it gives exception such as streamCorrecuptedException Why such exception occurs? Please help me From Parshuram Walunjkar
|
 |
 |
|
|
subject: How to send any java Object through socket?
|
|
|