How to tell how big size of a buffer to choose? [migrated]


I’m learning about networking with Python and I’ve encountered something I don’t understand.

particularly:

packet = server.recvfrom(2048)

I understand that .recv() and .recvfrom() methods determine the size of a buffer to work with but sometimes I see 1024, 2048, … and I can’t seem to connect the dots correctly as to how to know what size of a buffer to choose. The learning resources I’m working with aren’t explaining this and I would like to know.

I also understand that a buffer is a temporary data storage allocated within RAM.