juturna.utils.net_utils package#
Module contents#
- class juturna.utils.net_utils.RTPClient(host: str, port: int)#
Bases:
object
RTPClient is a class that represents a Real-time Transport Protocol (RTP) client. It is used to send and receive RTP packets over a network.
- connect()#
Connect to the RTP server by creating a UDP socket and binding it to the specified host and port.
- property connected#
- disconnect()#
Disconnect from the RTP server and clean up resources.
- rec(chunk_size: int = 1024) RTPDatagram #
Receive RTP packets from the server. This method blocks until a packet is received or an error occurs.
- Parameters:
chunk_size (int) – The size of the buffer to receive data. Default is 1024 bytes.
- Returns:
The received RTP datagram. If an error occurs, None is returned.
- Return type:
- send_terminate()#
Send a termination signal to the RTP server by sending a blank UDP packet. This is used to inform the server that the client is disconnecting.
- class juturna.utils.net_utils.RTPDatagram(datagram: Self)#
Bases:
object
RTP protocol datagram parser Based on github.com/plazmer/pyrtsp with minor cosmetic changes
- property datagram: bytes#
- juturna.utils.net_utils.get_available_port() int #
Returns an available port number. This function creates a socket, binds it to an available port, and then closes the socket.
- Returns:
An available port number.
- Return type:
int