What is the maximum packet size that a python socket can handle?

I am new to python network programming. I would like to know which maximum size packet we can transmit or receive on a python socket? and how to find out?

+5
source share
3 answers

The actual amount of data that can be sent in one packet depends on what maximum transmission unit ( MTU ) is for the protocol that you are using. Read the Wikipedia article for more information.

As a rule, you have nothing to worry about - if you send a TCP packet that is too large, the operating system will fragment (turn it into several packets) for you, and it will be assembled on the host.

By the way, the Python socket library uses operating system sockets, so it has nothing special for Python.

+5
source

I do not think that there are limitations specific to Python. UDP packets have a theoretical limit of about 65kb, and TCP is not an upper limit, but you will have flow control problems if you use packets much larger than a few kilobytes.

+1
source

, , , dpkt scapy.

0

All Articles