0

I have the following situation.

Assuming there are 3 systems: A,B,C and A is master.
so, B & C connects to the server at A.
if B & C would like to communicate,

will the following scenario work?

B connects to A, (creating a socket object at both B & A)
A sends socket object to C 

(C now has the same socket created using B' connection attempt to A)

 B and C can communicate with sockets they have.

Can this kind of communcation possible, I know of a way where either B connects to C, or C connects to B, but I don't want that here. (Also, I am not worried about the scale of the system, i.e., too many active sockets in the system)

1
  • 2
    Can you ring someone up and send them your telephone? Same situation. Commented Apr 2, 2012 at 0:45

2 Answers 2

2

A socket connects one of your local port to a port of the remote address. And it has a lifecycle, create, bind, close. Serializing sockets and sending to other JVM will not work.

Sign up to request clarification or add additional context in comments.

Comments

2

You cannot serialize socket instances. It wouldn't work at the JVM level or at the native machine level. What you can do is use your master server as a communication proxy between the two clients, or alternatively, too explicitly connect one client to the other.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.