libp2p.network.stream package¶
Submodules¶
libp2p.network.stream.exceptions module¶
-
exception
libp2p.network.stream.exceptions.
StreamClosed
¶
-
exception
libp2p.network.stream.exceptions.
StreamEOF
¶ Bases:
libp2p.network.stream.exceptions.StreamError
,EOFError
-
exception
libp2p.network.stream.exceptions.
StreamError
¶
-
exception
libp2p.network.stream.exceptions.
StreamReset
¶
libp2p.network.stream.net_stream module¶
-
class
libp2p.network.stream.net_stream.
NetStream
(muxed_stream: libp2p.stream_muxer.abc.IMuxedStream)¶ Bases:
libp2p.network.stream.net_stream_interface.INetStream
-
async
close
() → None¶ close stream.
-
get_protocol
() → NewType.<locals>.new_type¶ - Returns
protocol id that stream runs on
-
muxed_stream
: IMuxedStream = None¶
-
protocol_id
: Optional[TProtocol] = None¶
-
async
read
(n: int = None) → bytes¶ reads from stream.
- Parameters
n – number of bytes to read
- Returns
bytes of input
-
async
reset
() → None¶ Close both ends of the stream.
-
set_protocol
(protocol_id: NewType.<locals>.new_type) → None¶ - Parameters
protocol_id – protocol id that stream runs on
-
async
write
(data: bytes) → None¶ write to stream.
- Returns
number of bytes written
-
async
libp2p.network.stream.net_stream_interface module¶
-
class
libp2p.network.stream.net_stream_interface.
INetStream
¶ Bases:
libp2p.io.abc.ReadWriteCloser
-
abstract
get_protocol
() → NewType.<locals>.new_type¶ - Returns
protocol id that stream runs on
-
muxed_conn
: IMuxedConn = None¶
-
abstract async
reset
() → None¶ Close both ends of the stream.
-
abstract
set_protocol
(protocol_id: NewType.<locals>.new_type) → None¶ - Parameters
protocol_id – protocol id that stream runs on
-
abstract