java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1847)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1756)
at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1257)
at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1211)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1395)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:333)
at serverstreamtest.createStreamSocket.sendPerformance(createStreamSocket.java:96)
at serverstreamtest.createStreamSocket.<init>(createStreamSocket.java:68)
at serverstreamtest.Main.main(Main.java:27)

By the way thanks for this. Really appreciate it like you can not believe

The message seems pretty clear to me: the socket is closed. And since that's an error message telling you that, the implication is that the socket
shouldn't be closed. So that means you have to look at your code to find out why that is the case.

"Sending to a function" isn't standard Java terminology. However if your question could be translated as "If I call a method which closes a socket which
is passed as a parameter, does it close that socket?" then the answer is yes.