Package wtf :: Module _wtf_cstream :: Class MinimalSocketStream
[hide private]
[frames] | no frames]

Class MinimalSocketStream

object --+
         |
        MinimalSocketStream

MinimalSocketStream(sock)

Minimal stream out of a socket

This effectively maps recv to read and sendall to write.


See Also: GenericStream

Instance Methods [hide private]
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
a new object with type S, a subtype of T
__new__(T, S, ...)
 
close(...)
s.close()
str
read(...)
s.read(size) -> bytes
 
write(...)
s.write(data)

Inherited from object: __delattr__, __format__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  closed
  name

Inherited from object: __class__

Method Details [hide private]

__getattribute__(...)

 
x.__getattribute__('name') <==> x.name
Overrides: object.__getattribute__

__new__(T, S, ...)

 


Returns: a new object with type S, a subtype of T
Overrides: object.__new__

close(...)

 

s.close()

Close the stream (not necessarily the socket)

read(...)

 

s.read(size) -> bytes

Read size bytes (or less) from the socket

Parameters

  • size: The number of bytes to read (> 0)

Types

  • size: int
Returns: str
The bytes read
Raises:
  • ValueError - The stream is closed
  • socket.error - Something happened to the socket

write(...)

 

s.write(data)

Write data to the socket

Parameters

  • data: The data to write

Types

  • data: str
Raises:
  • ValueError - The stream is closed
  • socket.error - Something happened to the socket