-1

I am studying about network programming nowadays. So I am a little confused about P2P and Datagram .... what is the difference between these two?

I think both of them are connectionless networks.

But I know that in P2P (ad hoc) we don't have any access point. what about Datagram?

So why p2p java applications use DatagramSocket? I know that DatagramSocket can be used for a connectionless communication through a access point (Router)...

Thanks,

user3157047
  • 479
  • 5
  • 15
  • Neither of them is a connection less network. You are asking the difference between apples and oranges. The difference is that they are not the same. One is a piece of data, the other is a type of networking. – user207421 Jul 09 '14 at 00:13
  • Please refer to "Computer Networks - A Tanenbaum - 5th edition" and you can see: Datagram is an Unreliable (meaning not acknowledged) connectionless service – user3157047 Jul 09 '14 at 00:43
  • also refer to: http://www.webpelican.com/internet-programming-1/java-whiteboard/ there is no connection(connection-less) established between the sender and the receiver before data are sent. – user3157047 Jul 09 '14 at 00:46
  • "Connectionless network" doesn't appear in either of those quotations. UDP is a connectionless transport over which datagrams are sent. P2P is a networking mode. Mangling quotations to make different things sound the same so you can ask what's the difference between them isn't a rational mode of enquiry. – user207421 Jul 09 '14 at 00:52

1 Answers1

2

These are two completely different terms.

P2P means "Peer-to-Peer", which is connection between two or more subjects, which does not require any other authority (server, host) to be functional.

Datagram is, let me use wikipedia :a basic transfer unit associated with a packet-switched network in which the delivery, arrival time, and order of arrival are not guaranteed by the network.

It lies in completely different layer.

Therefore P2P connection can use datagram-based connection (like UDP) or it can use another one (like TCP). The otherway does not work, from the point of view of datagram, you do not know, who is using you.

libik
  • 22,239
  • 9
  • 44
  • 87