title: recv and recvfrom, socket programming using python
body: <p>i am new to python and new to socket programming as well.</p>
  
  <p>I am confused about about <code>socket.recvfrom()</code> and <code>socket.recv()</code></p>
  
  <p>I understand that usually for UDP, people use <code>recvfrom()</code> and for TCP, people use <code>recv()</code>.</p>
  
  <p>For example,</p>
  
  <pre><code>serverSocketUDP = socket(AF_INET, SOCK_DGRAM)
  serverSocketTCP = socket(AF_INET, SOCK_STREAM)
  #... define server...
  #...
  message, clientAddress = serverSocketUDP.recvfrom(2048) #why 2048 for UDP? Ive seen several examples like this.
  message2 = serverSocketTCP.recv(1024) #Again, why 1024 for TCP? 
  </code></pre>
  
  <p>As seen in the example above, what i am confused about is the numbers. Why 2048 and 1024 for different protocols? What does these numbers represent? Please explain. I hope i was clear enough. Thank you.</p>