0

I'm using Java Sockets from package java.net. I read that they use TCP, so I was curious to know which ARQ (Automatic Repeat reQuest) protocol they implement by default. I've looked in the documentation but could not find any information about this.

I know there are three main ARQ algorithms: stop-and-wait, go-back-n and selective repeat. Which one do Java Sockets use?

Andrea Rossi
  • 981
  • 1
  • 10
  • 23
  • 1
    Probably whatever the underlying OS's TCP stack implements. – Jim Garrison Jul 18 '17 at 15:54
  • 2
    What type of Java Socket do you mean? `Socket` or `DatagramSocket`? The former uses the TCP protocol so you should check what ARQ is used by TCP, not what ARQ is used by Sockets. DatagramSocket uses UDP which doesn't do automatic repeats. The Wikipedia page on ARQ already answers your question about TCP: "The Transmission Control Protocol uses a variant of Go-Back-N ARQ to ensure reliable transmission of data over the Internet Protocol, which does not provide guaranteed delivery of packets; with Selective Acknowledgement (SACK), it uses Selective Repeat ARQ.".Did you search the Internet first? – Erwin Bolwidt Jul 18 '17 at 16:02
  • My bad. I assumed that depending on the specific implementation, TCP could employ basically any ARQ so I did my research on this (wrong) premise. – Andrea Rossi Jul 19 '17 at 18:46

1 Answers1

2

The Java Socket APIs are typically wrappers around the operating systems socket APIs. The java APIs do simply instruct the operating system to create/bind/close sockets and to read or write data from them. The internal behavior of the sockets depends on the operating systems implementation. Sou would need to look up what the operating system you use (Windows/Linux/MacOS/etc.) uses and whether that is configurable.

Matthias247
  • 9,836
  • 1
  • 20
  • 29