P R
P R

Reputation: 1301

Multicasting in Java

I've got a lot of questions regarding this e.g.. Hence enumerating them:

  1. Why do they use datagram sockets? Is there another alternative to them?
  2. I'm trying to send objects over the datagram sockets in this example. It takes a long time for the server to receive the object from the client's side. Is there any alternative to that as well?

Note - I'm trying to integrate both programs to make a network discovery program wherein the client replies with it's details in the form of an object.

Upvotes: 2

Views: 435

Answers (1)

jman
jman

Reputation: 11596

For your first question, you need datagrams (UDP) because tcp is a connection oriented protocol. i.e., each connection is for communication between one server and one client. You can have multiple clients connected to a server, but they'd all be individual unicast communication.

Regarding your second question, I don't think a delay you observe is due to your code. Post more details about your topology, etc. to help solve that issue.

Upvotes: 3

Related Questions