mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
18 lines
492 B
Python
18 lines
492 B
Python
from socket import _fileobject
|
|
import socket
|
|
|
|
class filesocket(_fileobject):
|
|
|
|
def read(self, size=4096):
|
|
data = self._sock.recv(size)
|
|
if data is not None:
|
|
return data
|
|
|
|
class Socket26(socket._socketobject):
|
|
|
|
def makefile(self, mode='r', bufsize=-1):
|
|
"""makefile([mode[, bufsize]]) -> file object
|
|
Return a regular file object corresponding to the socket. The mode
|
|
and bufsize arguments are as for the built-in open() function."""
|
|
return filesocket(self._sock, mode, bufsize)
|
|
|