Why maximum length of IP, TCP, UDP packet is not suit?Is ADSL's UDP packet forwarding rate strictly linear to...

What is the wife of a henpecked husband called?

What game did these black and yellow dice come from?

Does the US government have any planning in place to ensure there's no shortages of food, fuel, steel and other commodities?

How can the probability of a fumble decrease linearly with more dice?

List of invertible congruence classes

Why is the size of a directory either 0 or 4096?

What is the difference between "...", '...', $'...', and $"..." quotes?

What can I do to encourage my players to use their consumables?

Eww, those bytes are gross

How is it possible that the folder is there yet isnt in the same time?

What's the oldest plausible frozen specimen for a Jurassic Park style story-line?

Calculate of total length of edges in Voronoi diagram

How to politely refuse in-office gym instructor for steroids and protein

What species should be used for storage of human minds?

Where do we learn that students are like offspring?

What makes papers publishable in top-tier journals?

Has any human ever had the choice to leave Earth permanently?

Categorical Unification of Jordan Holder Theorems

Is there a verb that means to inject with poison?

Count repetitions of an array

The No-Straight Maze

Book where a space ship journeys to the center of the galaxy to find all the stars had gone supernova

What is the industry term for house wiring diagrams?

How do you funnel food off a cutting board?



Why maximum length of IP, TCP, UDP packet is not suit?


Is ADSL's UDP packet forwarding rate strictly linear to packet size?What is the actual size of an Ethernet MTUWhy do we need the data link layer in Ethernet?1522-byte frames from access point being dropped by gatewayOSI model encapsulationWhy does the round-trip time of a TCP message decrease 100-fold as the message size exceeds the maximum segment size?TCP segment length and TCP/IP header optionsWhy is a TCP Socket identified by a 4 tuple?How does a TCP segment fit into a smaller IP packet?Why maximum length of IP、TCP、UDP packet is not suit?













3















From many tutorials, I get follow knowledge(maybe I'm misunderstood) :




  • maximum of an Ethernet packet is about 1500 bytes.


  • maximum of an IP packet is about 65535 bytes.


  • maximum of a UDP packet is 65515 bytes



But when I made a test and watch Wireshark, I get a different answer.




  1. I try to send some big data with TCP protocol.



Socket con = new Socket("localhost", 8088);
OutputStream os = con.getOutputStream();

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// about 110k bytes
byte[] data = s.toString().getBytes();

os.write(data);
os.close();
con.close();


This is my Java code (it's not necessary to understand this.), I try to send 110k bytes data with a TCP connection. This is my Wireshark.



enter image description here



My 110k bytes message is split to 7 packets, I think this shows that maximum length of a TCP packet is 16388 bytes.




  1. Then, I try to send a UDP packet:


    DatagramSocket client = new DatagramSocket(50555);

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// 110k bytes
byte[] data = s.toString().getBytes();

int messageLength = data.length;
for (; ; messageLength--){
try{
DatagramPacket packet = new DatagramPacket(data, messageLength,
new InetSocketAddress("localhost", 8088));
// If packet is still too lang, above line will throws an exception

// If there is not any exception, means we can send this packet
// and this messageLength is the limit value for a UDP packet.
client.send(packet);
System.out.println("message length is " + messageLength);

// break for loop
break;
} catch(Exception e){
// fail to send and continue for loop
}
}
client.close();


the result ismessage length is 65507.



I was really confused:




  • IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?


  • Why an TCP packet is only 16388 bytes?



Then I have read many post on SOF or other websites, But I don't get an answer, I think is not duplicate to others.










share|improve this question









New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • "Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

    – Ron Maupin
    4 hours ago











  • @RonMaupin, please merge on Network Eng.

    – Bhargav Rao
    4 hours ago






  • 1





    Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

    – user207421
    1 hour ago













  • @user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

    – Zac67
    34 mins ago


















3















From many tutorials, I get follow knowledge(maybe I'm misunderstood) :




  • maximum of an Ethernet packet is about 1500 bytes.


  • maximum of an IP packet is about 65535 bytes.


  • maximum of a UDP packet is 65515 bytes



But when I made a test and watch Wireshark, I get a different answer.




  1. I try to send some big data with TCP protocol.



Socket con = new Socket("localhost", 8088);
OutputStream os = con.getOutputStream();

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// about 110k bytes
byte[] data = s.toString().getBytes();

os.write(data);
os.close();
con.close();


This is my Java code (it's not necessary to understand this.), I try to send 110k bytes data with a TCP connection. This is my Wireshark.



enter image description here



My 110k bytes message is split to 7 packets, I think this shows that maximum length of a TCP packet is 16388 bytes.




  1. Then, I try to send a UDP packet:


    DatagramSocket client = new DatagramSocket(50555);

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// 110k bytes
byte[] data = s.toString().getBytes();

int messageLength = data.length;
for (; ; messageLength--){
try{
DatagramPacket packet = new DatagramPacket(data, messageLength,
new InetSocketAddress("localhost", 8088));
// If packet is still too lang, above line will throws an exception

// If there is not any exception, means we can send this packet
// and this messageLength is the limit value for a UDP packet.
client.send(packet);
System.out.println("message length is " + messageLength);

// break for loop
break;
} catch(Exception e){
// fail to send and continue for loop
}
}
client.close();


the result ismessage length is 65507.



I was really confused:




  • IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?


  • Why an TCP packet is only 16388 bytes?



Then I have read many post on SOF or other websites, But I don't get an answer, I think is not duplicate to others.










share|improve this question









New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • "Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

    – Ron Maupin
    4 hours ago











  • @RonMaupin, please merge on Network Eng.

    – Bhargav Rao
    4 hours ago






  • 1





    Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

    – user207421
    1 hour ago













  • @user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

    – Zac67
    34 mins ago
















3












3








3


0






From many tutorials, I get follow knowledge(maybe I'm misunderstood) :




  • maximum of an Ethernet packet is about 1500 bytes.


  • maximum of an IP packet is about 65535 bytes.


  • maximum of a UDP packet is 65515 bytes



But when I made a test and watch Wireshark, I get a different answer.




  1. I try to send some big data with TCP protocol.



Socket con = new Socket("localhost", 8088);
OutputStream os = con.getOutputStream();

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// about 110k bytes
byte[] data = s.toString().getBytes();

os.write(data);
os.close();
con.close();


This is my Java code (it's not necessary to understand this.), I try to send 110k bytes data with a TCP connection. This is my Wireshark.



enter image description here



My 110k bytes message is split to 7 packets, I think this shows that maximum length of a TCP packet is 16388 bytes.




  1. Then, I try to send a UDP packet:


    DatagramSocket client = new DatagramSocket(50555);

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// 110k bytes
byte[] data = s.toString().getBytes();

int messageLength = data.length;
for (; ; messageLength--){
try{
DatagramPacket packet = new DatagramPacket(data, messageLength,
new InetSocketAddress("localhost", 8088));
// If packet is still too lang, above line will throws an exception

// If there is not any exception, means we can send this packet
// and this messageLength is the limit value for a UDP packet.
client.send(packet);
System.out.println("message length is " + messageLength);

// break for loop
break;
} catch(Exception e){
// fail to send and continue for loop
}
}
client.close();


the result ismessage length is 65507.



I was really confused:




  • IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?


  • Why an TCP packet is only 16388 bytes?



Then I have read many post on SOF or other websites, But I don't get an answer, I think is not duplicate to others.










share|improve this question









New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












From many tutorials, I get follow knowledge(maybe I'm misunderstood) :




  • maximum of an Ethernet packet is about 1500 bytes.


  • maximum of an IP packet is about 65535 bytes.


  • maximum of a UDP packet is 65515 bytes



But when I made a test and watch Wireshark, I get a different answer.




  1. I try to send some big data with TCP protocol.



Socket con = new Socket("localhost", 8088);
OutputStream os = con.getOutputStream();

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// about 110k bytes
byte[] data = s.toString().getBytes();

os.write(data);
os.close();
con.close();


This is my Java code (it's not necessary to understand this.), I try to send 110k bytes data with a TCP connection. This is my Wireshark.



enter image description here



My 110k bytes message is split to 7 packets, I think this shows that maximum length of a TCP packet is 16388 bytes.




  1. Then, I try to send a UDP packet:


    DatagramSocket client = new DatagramSocket(50555);

StringBuilder s = new StringBuilder();
for( int i = 0; i < 10000; i++) {
s.append("Hello world");
}
// 110k bytes
byte[] data = s.toString().getBytes();

int messageLength = data.length;
for (; ; messageLength--){
try{
DatagramPacket packet = new DatagramPacket(data, messageLength,
new InetSocketAddress("localhost", 8088));
// If packet is still too lang, above line will throws an exception

// If there is not any exception, means we can send this packet
// and this messageLength is the limit value for a UDP packet.
client.send(packet);
System.out.println("message length is " + messageLength);

// break for loop
break;
} catch(Exception e){
// fail to send and continue for loop
}
}
client.close();


the result ismessage length is 65507.



I was really confused:




  • IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?


  • Why an TCP packet is only 16388 bytes?



Then I have read many post on SOF or other websites, But I don't get an answer, I think is not duplicate to others.







ip ethernet tcp udp






share|improve this question









New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









Cown

6,26131030




6,26131030






New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 4 hours ago









saltfishsaltfish

1161




1161




New contributor




saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






saltfish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • "Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

    – Ron Maupin
    4 hours ago











  • @RonMaupin, please merge on Network Eng.

    – Bhargav Rao
    4 hours ago






  • 1





    Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

    – user207421
    1 hour ago













  • @user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

    – Zac67
    34 mins ago





















  • "Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

    – Ron Maupin
    4 hours ago











  • @RonMaupin, please merge on Network Eng.

    – Bhargav Rao
    4 hours ago






  • 1





    Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

    – user207421
    1 hour ago













  • @user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

    – Zac67
    34 mins ago



















"Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

– Ron Maupin
4 hours ago





"Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?" Ethernet is not the only data-link protocol that can carry IP. More devices are now shipped with Wi-Fi than with ethernet. There are other protocols each of which has a different MTU (payload, e.g. IP, size).

– Ron Maupin
4 hours ago













@RonMaupin, please merge on Network Eng.

– Bhargav Rao
4 hours ago





@RonMaupin, please merge on Network Eng.

– Bhargav Rao
4 hours ago




1




1





Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

– user207421
1 hour ago







Terminology please. Maximum length of an Ethernet frame is 1500 bytes. IP packets can span frames in the physical layer. Maximum length of a UDP datagram is 65507 bytes, given by the IP maximum packet size (which is 65535, and not 'about'), less 20 for the IP header, less 8 for the UDP header. The maximum length of a TCP segment is described in 32 bits.

– user207421
1 hour ago















@user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

– Zac67
34 mins ago







@user207421 The maximum length of an Ethernet frame (w/o options) is 1518 bytes. 1500 bytes is the maximum L2 payload size or SDU (aka MTU for IP).

– Zac67
34 mins ago












2 Answers
2






active

oldest

votes


















4















IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?




Ethernet is one of several physical layers which can be used to to transport IP (and also protocols besides IP). The size of the packet a physical layer can transport is specific to this physical layer, other physical layers have other properties. Note that in your specific case of communicating on localhost (127.0.0.1) no physical layer (and thus no ethernet) is involved at all since localhost is just a logical but not a physical network interface.



The 65535 bytes limit in IP is because the length field in the IP header is only 16 bit.




Why an TCP packet is only 16388 bytes?




The applications sends data to the OS kernel which then packetizes the data. The size of the data which can be send to the kernel at once depend on the size of the socket buffer which results in the packet size you see. Additionally the kernel might further split the data to best fit the maximum size of the underlying physical layer (like ethernet). With TCP the kernel might also decide to join small data so that they get transmitted together.



Note that for TCP the packet length on the wire is actually irrelevant for the application since TCP is a continuous data stream. With UDP this would be different, i.e. every send would result in a single IP message and would also be received as such single message by the recipient.






share|improve this answer































    3














    Different data-link protocols were designed by different people at different times, and they each have their own MTU (maximum payload size). Ethernet was a college thesis for Bob Metcalfe, and it was designed with a 1500 octet MTU. This was about the time (1970s) that the predecessor for IP was being created by Vint Cerf. I seriously doubt either even knew the other or what the other was working on, and it is certain that neither knew that the other would become dominant, even after they were made products (ethernet in 1980 and IPv4 in 1981). Other people and other companies developed other data-link protocols, each with a different MTU specified by the protocol designer.



    IP, and other network protocols, are the payload of the data-link protocol, so IP packets must fit inside the payload (MTU) of the data-link protocol. IP was designed with its maximum packet size because it was fast and easy to use a 16-bit number for the packet size. IPv4 has a 20 to 60 octet header that you must subtract from the packet size. IPv6 has a 40 octet header, and possible option headers.



    A transport protocol, such as UDP or TCP is the payload of the network protocol. UDP has a datagram header size of 8 octets, and TCP has a segment header of at least 20 octets.



    The network protocol and transport protocol headers must be subtracted from the data-link protocol MTU to arrive at the maximum amount of application data that can be transported inside a data-link frame. That would include any application-layer protocol, e.g. HTTP.





    I guess the part that you are missing is that network protocols were basically all developed independently, by different people, with different ideas, at different times. What we use today are the protocols that became dominant over the years, for one reason or another. Many of these protocols have nothing to do with each other. For example, ethernet can carry any number of network protocols (IPv4, IPX, AppleTalk, IPv6, etc., ethernet was primarily used for IPX for years, which has nothing to do with IP), and neither IP version (IPv4 and IPv6) cares which data-link protocol (ethernet, Wi-Fi, ARCNET, token ring, FDDI, frame relay, HDLC, PPP, ATM, etc.) carries it.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "496"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      saltfish is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f57211%2fwhy-maximum-length-of-ip-tcp-udp-packet-is-not-suit%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4















      IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?




      Ethernet is one of several physical layers which can be used to to transport IP (and also protocols besides IP). The size of the packet a physical layer can transport is specific to this physical layer, other physical layers have other properties. Note that in your specific case of communicating on localhost (127.0.0.1) no physical layer (and thus no ethernet) is involved at all since localhost is just a logical but not a physical network interface.



      The 65535 bytes limit in IP is because the length field in the IP header is only 16 bit.




      Why an TCP packet is only 16388 bytes?




      The applications sends data to the OS kernel which then packetizes the data. The size of the data which can be send to the kernel at once depend on the size of the socket buffer which results in the packet size you see. Additionally the kernel might further split the data to best fit the maximum size of the underlying physical layer (like ethernet). With TCP the kernel might also decide to join small data so that they get transmitted together.



      Note that for TCP the packet length on the wire is actually irrelevant for the application since TCP is a continuous data stream. With UDP this would be different, i.e. every send would result in a single IP message and would also be received as such single message by the recipient.






      share|improve this answer




























        4















        IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?




        Ethernet is one of several physical layers which can be used to to transport IP (and also protocols besides IP). The size of the packet a physical layer can transport is specific to this physical layer, other physical layers have other properties. Note that in your specific case of communicating on localhost (127.0.0.1) no physical layer (and thus no ethernet) is involved at all since localhost is just a logical but not a physical network interface.



        The 65535 bytes limit in IP is because the length field in the IP header is only 16 bit.




        Why an TCP packet is only 16388 bytes?




        The applications sends data to the OS kernel which then packetizes the data. The size of the data which can be send to the kernel at once depend on the size of the socket buffer which results in the packet size you see. Additionally the kernel might further split the data to best fit the maximum size of the underlying physical layer (like ethernet). With TCP the kernel might also decide to join small data so that they get transmitted together.



        Note that for TCP the packet length on the wire is actually irrelevant for the application since TCP is a continuous data stream. With UDP this would be different, i.e. every send would result in a single IP message and would also be received as such single message by the recipient.






        share|improve this answer


























          4












          4








          4








          IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?




          Ethernet is one of several physical layers which can be used to to transport IP (and also protocols besides IP). The size of the packet a physical layer can transport is specific to this physical layer, other physical layers have other properties. Note that in your specific case of communicating on localhost (127.0.0.1) no physical layer (and thus no ethernet) is involved at all since localhost is just a logical but not a physical network interface.



          The 65535 bytes limit in IP is because the length field in the IP header is only 16 bit.




          Why an TCP packet is only 16388 bytes?




          The applications sends data to the OS kernel which then packetizes the data. The size of the data which can be send to the kernel at once depend on the size of the socket buffer which results in the packet size you see. Additionally the kernel might further split the data to best fit the maximum size of the underlying physical layer (like ethernet). With TCP the kernel might also decide to join small data so that they get transmitted together.



          Note that for TCP the packet length on the wire is actually irrelevant for the application since TCP is a continuous data stream. With UDP this would be different, i.e. every send would result in a single IP message and would also be received as such single message by the recipient.






          share|improve this answer














          IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes?




          Ethernet is one of several physical layers which can be used to to transport IP (and also protocols besides IP). The size of the packet a physical layer can transport is specific to this physical layer, other physical layers have other properties. Note that in your specific case of communicating on localhost (127.0.0.1) no physical layer (and thus no ethernet) is involved at all since localhost is just a logical but not a physical network interface.



          The 65535 bytes limit in IP is because the length field in the IP header is only 16 bit.




          Why an TCP packet is only 16388 bytes?




          The applications sends data to the OS kernel which then packetizes the data. The size of the data which can be send to the kernel at once depend on the size of the socket buffer which results in the packet size you see. Additionally the kernel might further split the data to best fit the maximum size of the underlying physical layer (like ethernet). With TCP the kernel might also decide to join small data so that they get transmitted together.



          Note that for TCP the packet length on the wire is actually irrelevant for the application since TCP is a continuous data stream. With UDP this would be different, i.e. every send would result in a single IP message and would also be received as such single message by the recipient.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Steffen UllrichSteffen Ullrich

          1,17868




          1,17868























              3














              Different data-link protocols were designed by different people at different times, and they each have their own MTU (maximum payload size). Ethernet was a college thesis for Bob Metcalfe, and it was designed with a 1500 octet MTU. This was about the time (1970s) that the predecessor for IP was being created by Vint Cerf. I seriously doubt either even knew the other or what the other was working on, and it is certain that neither knew that the other would become dominant, even after they were made products (ethernet in 1980 and IPv4 in 1981). Other people and other companies developed other data-link protocols, each with a different MTU specified by the protocol designer.



              IP, and other network protocols, are the payload of the data-link protocol, so IP packets must fit inside the payload (MTU) of the data-link protocol. IP was designed with its maximum packet size because it was fast and easy to use a 16-bit number for the packet size. IPv4 has a 20 to 60 octet header that you must subtract from the packet size. IPv6 has a 40 octet header, and possible option headers.



              A transport protocol, such as UDP or TCP is the payload of the network protocol. UDP has a datagram header size of 8 octets, and TCP has a segment header of at least 20 octets.



              The network protocol and transport protocol headers must be subtracted from the data-link protocol MTU to arrive at the maximum amount of application data that can be transported inside a data-link frame. That would include any application-layer protocol, e.g. HTTP.





              I guess the part that you are missing is that network protocols were basically all developed independently, by different people, with different ideas, at different times. What we use today are the protocols that became dominant over the years, for one reason or another. Many of these protocols have nothing to do with each other. For example, ethernet can carry any number of network protocols (IPv4, IPX, AppleTalk, IPv6, etc., ethernet was primarily used for IPX for years, which has nothing to do with IP), and neither IP version (IPv4 and IPv6) cares which data-link protocol (ethernet, Wi-Fi, ARCNET, token ring, FDDI, frame relay, HDLC, PPP, ATM, etc.) carries it.






              share|improve this answer






























                3














                Different data-link protocols were designed by different people at different times, and they each have their own MTU (maximum payload size). Ethernet was a college thesis for Bob Metcalfe, and it was designed with a 1500 octet MTU. This was about the time (1970s) that the predecessor for IP was being created by Vint Cerf. I seriously doubt either even knew the other or what the other was working on, and it is certain that neither knew that the other would become dominant, even after they were made products (ethernet in 1980 and IPv4 in 1981). Other people and other companies developed other data-link protocols, each with a different MTU specified by the protocol designer.



                IP, and other network protocols, are the payload of the data-link protocol, so IP packets must fit inside the payload (MTU) of the data-link protocol. IP was designed with its maximum packet size because it was fast and easy to use a 16-bit number for the packet size. IPv4 has a 20 to 60 octet header that you must subtract from the packet size. IPv6 has a 40 octet header, and possible option headers.



                A transport protocol, such as UDP or TCP is the payload of the network protocol. UDP has a datagram header size of 8 octets, and TCP has a segment header of at least 20 octets.



                The network protocol and transport protocol headers must be subtracted from the data-link protocol MTU to arrive at the maximum amount of application data that can be transported inside a data-link frame. That would include any application-layer protocol, e.g. HTTP.





                I guess the part that you are missing is that network protocols were basically all developed independently, by different people, with different ideas, at different times. What we use today are the protocols that became dominant over the years, for one reason or another. Many of these protocols have nothing to do with each other. For example, ethernet can carry any number of network protocols (IPv4, IPX, AppleTalk, IPv6, etc., ethernet was primarily used for IPX for years, which has nothing to do with IP), and neither IP version (IPv4 and IPv6) cares which data-link protocol (ethernet, Wi-Fi, ARCNET, token ring, FDDI, frame relay, HDLC, PPP, ATM, etc.) carries it.






                share|improve this answer




























                  3












                  3








                  3







                  Different data-link protocols were designed by different people at different times, and they each have their own MTU (maximum payload size). Ethernet was a college thesis for Bob Metcalfe, and it was designed with a 1500 octet MTU. This was about the time (1970s) that the predecessor for IP was being created by Vint Cerf. I seriously doubt either even knew the other or what the other was working on, and it is certain that neither knew that the other would become dominant, even after they were made products (ethernet in 1980 and IPv4 in 1981). Other people and other companies developed other data-link protocols, each with a different MTU specified by the protocol designer.



                  IP, and other network protocols, are the payload of the data-link protocol, so IP packets must fit inside the payload (MTU) of the data-link protocol. IP was designed with its maximum packet size because it was fast and easy to use a 16-bit number for the packet size. IPv4 has a 20 to 60 octet header that you must subtract from the packet size. IPv6 has a 40 octet header, and possible option headers.



                  A transport protocol, such as UDP or TCP is the payload of the network protocol. UDP has a datagram header size of 8 octets, and TCP has a segment header of at least 20 octets.



                  The network protocol and transport protocol headers must be subtracted from the data-link protocol MTU to arrive at the maximum amount of application data that can be transported inside a data-link frame. That would include any application-layer protocol, e.g. HTTP.





                  I guess the part that you are missing is that network protocols were basically all developed independently, by different people, with different ideas, at different times. What we use today are the protocols that became dominant over the years, for one reason or another. Many of these protocols have nothing to do with each other. For example, ethernet can carry any number of network protocols (IPv4, IPX, AppleTalk, IPv6, etc., ethernet was primarily used for IPX for years, which has nothing to do with IP), and neither IP version (IPv4 and IPv6) cares which data-link protocol (ethernet, Wi-Fi, ARCNET, token ring, FDDI, frame relay, HDLC, PPP, ATM, etc.) carries it.






                  share|improve this answer















                  Different data-link protocols were designed by different people at different times, and they each have their own MTU (maximum payload size). Ethernet was a college thesis for Bob Metcalfe, and it was designed with a 1500 octet MTU. This was about the time (1970s) that the predecessor for IP was being created by Vint Cerf. I seriously doubt either even knew the other or what the other was working on, and it is certain that neither knew that the other would become dominant, even after they were made products (ethernet in 1980 and IPv4 in 1981). Other people and other companies developed other data-link protocols, each with a different MTU specified by the protocol designer.



                  IP, and other network protocols, are the payload of the data-link protocol, so IP packets must fit inside the payload (MTU) of the data-link protocol. IP was designed with its maximum packet size because it was fast and easy to use a 16-bit number for the packet size. IPv4 has a 20 to 60 octet header that you must subtract from the packet size. IPv6 has a 40 octet header, and possible option headers.



                  A transport protocol, such as UDP or TCP is the payload of the network protocol. UDP has a datagram header size of 8 octets, and TCP has a segment header of at least 20 octets.



                  The network protocol and transport protocol headers must be subtracted from the data-link protocol MTU to arrive at the maximum amount of application data that can be transported inside a data-link frame. That would include any application-layer protocol, e.g. HTTP.





                  I guess the part that you are missing is that network protocols were basically all developed independently, by different people, with different ideas, at different times. What we use today are the protocols that became dominant over the years, for one reason or another. Many of these protocols have nothing to do with each other. For example, ethernet can carry any number of network protocols (IPv4, IPX, AppleTalk, IPv6, etc., ethernet was primarily used for IPX for years, which has nothing to do with IP), and neither IP version (IPv4 and IPv6) cares which data-link protocol (ethernet, Wi-Fi, ARCNET, token ring, FDDI, frame relay, HDLC, PPP, ATM, etc.) carries it.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 1 hour ago

























                  answered 4 hours ago









                  Ron MaupinRon Maupin

                  66k1369123




                  66k1369123






















                      saltfish is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      saltfish is a new contributor. Be nice, and check out our Code of Conduct.













                      saltfish is a new contributor. Be nice, and check out our Code of Conduct.












                      saltfish is a new contributor. Be nice, and check out our Code of Conduct.
















                      Thanks for contributing an answer to Network Engineering Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f57211%2fwhy-maximum-length-of-ip-tcp-udp-packet-is-not-suit%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                      Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

                      looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...