StarkBR
StarkBR

Reputation: 237

Differences between makefile() and send() recv() Python

Whats the purporse of using makefile() when working with Python Sockets??

I can make a program works just with send() and recv() functions on Python. But i read that is better to use the makefile() method to buffer the data. I didn't understand this relation and differences...any help?

Tks !

Upvotes: 5

Views: 3475

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273766

You can use makefile if you find the file interface of Python convenient. For example, you can then use methods like readlines on the socket (you'd have to implement it manually when using recv). This can be more convenient if sending text data on the socket, but YMMV.

Upvotes: 4

Related Questions