Socket#
- ignis.utils.Utils.listen_socket(sock: socket, errors: Literal['strict', 'replace', 'ignore'] = 'strict') Generator[str, None, None] #
Listen to the socket. This function is a generator.
- Parameters:
sock (
socket
) -- An instance of a socket.errors (
Literal
['strict'
,'replace'
,'ignore'
], default:'strict'
) -- The error handling scheme that will be passed tobytes.decode()
.
- Return type:
- Returns:
A generator that yields responses from the socket.
Example usage:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock: sock.connect("path/to/socket.sock") for message in Utils.listen_socket(sock): print(message)
- ignis.utils.Utils.send_socket(sock: socket, message: str, errors: Literal['strict', 'replace', 'ignore'] = 'strict') str #
Send a message to the socket.
- Parameters:
sock (
socket
) -- An instance of a socket.message (
str
) -- The message to send.errors (
Literal
['strict'
,'replace'
,'ignore'
], default:'strict'
) -- The error handling scheme that will be passed tobytes.decode()
.
- Return type:
- Returns:
The response from the socket.