2010-01-08 15:45:26 +00:00
|
|
|
from socket import _fileobject
|
2010-01-25 18:40:44 +00:00
|
|
|
import socket
|
2010-01-08 15:45:26 +00:00
|
|
|
|
|
|
|
class filesocket(_fileobject):
|
|
|
|
|
2010-01-25 18:40:44 +00:00
|
|
|
def read(self, size=4096):
|
2010-01-08 15:45:26 +00:00
|
|
|
data = self._sock.recv(size)
|
|
|
|
if data is not None:
|
|
|
|
return data
|
2010-01-25 18:40:44 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
|