title: Why UDP maximum segment size is far greater than TCP maximum segment size in this output?
body: <p>I tried the following code to find out maximum segment size in TCP and UDP sockets. I might be wrong because I am using <code>IPPROTO_TCP</code> and <code>TCP_MAXSEG</code> for <code>SOCK_DGRAM</code> but I'm getting a value and I want to know the reason. </p>
  
  <pre><code>if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) &lt; 0)
      perror("cant create socket");
  
  aopt = sizeof(optval);
  getsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, (char *)&amp;optval, &amp;aopt);
  printf("tcp max segment size is=%d\n", optval);
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>tcp max segment size is=536
  </code></pre>
  
  <p>then I tried then same with an UDP socket:</p>
  
  <pre><code>if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) &lt; 0)
      perror("cant create socket");
  
  aopt = sizeof(optval);
  getsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, (char *)&amp;optval, &amp;aopt);
  printf("udp max segment size is=%d\n", optval);
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>udp max segment size is=134514139
  </code></pre>