frost.server.socketio package¶
Submodules¶
frost.server.socketio.base_server module¶
-
class
frost.server.socketio.base_server.
BaseServer
(ip: str = '127.0.0.1', port: int = 5555)¶ Bases:
object
A basic socket server to send and receive data from multiple clients. Assign self.func to a method with
conn, addr
as parameters to handle new user connections, as shown infrost.server.server.FrostServer.on_user_connect()
- Parameters
ip (str, optional) – The IP address for the server to bind to, defaults to ‘127.0.0.1’
port (int, optional) – The port for the server to bind to, defaults to 5555
-
recieve
(conn: socket.socket) → Any¶ Receive data from a specific client.
- Parameters
conn (socket.socket) – The connected client socket
- Returns
The data received from the client
- Return type
Any
-
send
(conn: socket.socket, data: Any) → None¶ Send data to a specific connected client.
- Parameters
conn (socket.socket) – The connected client socket
data (Any) – The data to send to the client
-
start
() → None¶ Starts the threaded, multi-client server.
-
class
frost.server.socketio.base_server.
ConnectionData
(conn: Optional[socket.socket] = None, addr: Optional[Tuple[str, int]] = None)¶ Bases:
object
An object used to store connection data accross threads.
- Parameters
conn (Optional[socket.socket]) – The client’s connection, defaults to None
addr (Optional[Tuple[str, int]]) – The client’s IP address and port, defaults to None
-
addr
: Optional[Tuple[str, int]] = None¶
-
conn
: Optional[socket.socket] = None¶
frost.server.socketio.utils module¶
-
class
frost.server.socketio.utils.
threaded
(*args: Any, **kwargs: Any)¶ Bases:
object
A decorator to thread a function/method.
Module contents¶
-
class
frost.server.socketio.
BaseServer
(ip: str = '127.0.0.1', port: int = 5555)¶ Bases:
object
A basic socket server to send and receive data from multiple clients. Assign self.func to a method with
conn, addr
as parameters to handle new user connections, as shown infrost.server.server.FrostServer.on_user_connect()
- Parameters
ip (str, optional) – The IP address for the server to bind to, defaults to ‘127.0.0.1’
port (int, optional) – The port for the server to bind to, defaults to 5555
-
recieve
(conn: socket.socket) → Any¶ Receive data from a specific client.
- Parameters
conn (socket.socket) – The connected client socket
- Returns
The data received from the client
- Return type
Any
-
send
(conn: socket.socket, data: Any) → None¶ Send data to a specific connected client.
- Parameters
conn (socket.socket) – The connected client socket
data (Any) – The data to send to the client
-
start
() → None¶ Starts the threaded, multi-client server.
-
class
frost.server.socketio.
threaded
(*args: Any, **kwargs: Any)¶ Bases:
object
A decorator to thread a function/method.