I have String array object. Lets say
String[] names = new String[7];
And I am also making this object persistent by storing it into file using ObjectOutputStream on my client system. I am reading the stored object using ObjectInputStream. Upto this Okay. Now I want to send this object to another system over socket.
How to do it? Please help. Thanks.
You should create instance of Socket
get output stream and write to it (e.g. with ObjectOutputStream).
Socket echoSocket = new Socket(hostName, portNumber);
ObjectOutputStream out = new ObjectOutputStream(echoSocket.getOutputStream());
out.writeObject(names);
You can find an example in Oracle docs: example.
Also this answer should be helpful for you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With