pybitmessage.network.udp module

UDP protocol handler

class UDPSocket(host=None, sock=None, announcing=False)[source]

Bases: pybitmessage.network.bmproto.BMProto

Bitmessage protocol over UDP (class)

port = 8444
set_socket_reuse()

Set socket reuse option

bm_command_getdata()

Incoming request for object(s). If we have them and some other conditions are fulfilled, append them to the write queue.

bm_command_inv()

Non-dandelion announce

bm_command_addr()

Incoming addresses, process them

bm_command_portcheck()

Incoming port check request, queue it.

bm_command_ping()

Incoming ping, respond to it.

bm_command_pong()

Incoming pong. Ignore it. PyBitmessage pings connections after about 5 minutes of inactivity, and leaves it to the TCP stack to handle actual timeouts. So there is no need to do anything when a pong arrives.

bm_command_verack()

Incoming verack. If already sent my own verack, handshake is complete (except potentially waiting for buffers to flush), so we can continue to the main connection phase. If not sent verack yet, continue processing.

bm_command_version()

Incoming version. Parse and log, remember important things, like streams, bitfields, etc.

handle_connect()

Method for handling connection established implementations.

writable()

Is data from the write buffer ready to be sent to the network?

readable()

Is the read buffer ready to accept data from the network?

handle_read()

Append incoming data to the read buffer.

handle_write()

Send outgoing data from write buffer.