Is it possible to send an object using Sockets, if so, how
it can be?

Answer Posted / afzi

Yes it is Poosible to send an Object using Sockets,

for example refer to below given code snippet.

ObjectOutputStream out = new ObjectOutputStream
(socket.getOutputStream());
out.flush();
ObjectInputStream in = new ObjectInputStream
(socket.getInputStream());
type=(String)in.readObject();
out.writeObject("ok");
in.close();
out.close();
socket.close();

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is socket in java?

830


What is the use of network interface?

668


What is a listener in networking?

788


If you do not want your program to halt while it waits for a connection, put the call to accept( ) in a separate thread?

716


What is cookies in networking ?

798


What is the Difference between socket and servlet?

1013


How we can make simple java program for Server/Client Communication

837


What is the main difference between Client side Java Script and and Server side Java Script how actually they run on both side with Example.

847


What is a thread pool?

819


What is network interface name?

715


Explain a time server?

770


What are the advantages and disadvantages of sockets?

764


Explain the generic term internet.

777


To create a socket, you need to know the internet host to which you want to connect?

733


What you know about random port?

735