MCPcopy Index your code
hub / github.com/python/cpython / write

Method write

Lib/socket.py:743–757  ·  view source on GitHub ↗

Write the given bytes or bytearray object *b* to the socket and return the number of bytes written. This can be less than len(b) if not all data could be written. If the socket is non-blocking and no bytes could be written None is returned.

(self, b)

Source from the content-addressed store, hash-verified

741 raise
742
743 def write(self, b):
744 """Write the given bytes or bytearray object *b* to the socket
745 and return the number of bytes written. This can be less than
746 len(b) if not all data could be written. If the socket is
747 non-blocking and no bytes could be written None is returned.
748 """
749 self._checkClosed()
750 self._checkWritable()
751 try:
752 return self._sock.send(b)
753 except error as e:
754 # XXX what about EINTR?
755 if e.errno in _blocking_errnos:
756 return None
757 raise
758
759 def readable(self):
760 """True if the SocketIO is open for reading.

Callers

nothing calls this directly

Calls 3

_checkClosedMethod · 0.45
_checkWritableMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected