networking¶
- class networking.networking.client(ip_address, port='2001')¶
Bases:
object
client class
- close(shutdown=True)¶
close socket
- Parameters
shutdown (bool, optional) -- if true, also shutdown socketx, defaults to True
- readline()¶
read a line from buffer
- Raises
Exception -- if buffer is empty => client disconnected
- Returns
data read without
- Return type
string
- receive(limit, is_byte=False)¶
receive data
- Parameters
limit (int) -- receive limit
is_byte (bool, optional) -- if byte = True : no encoding , defaults to False
- Returns
data in string if is_byte = False, otherwise in byte form
- Return type
string or byte
- send(data, is_byte=False)¶
send data
- Parameters
data (string if is_byte = False, otherwise byte) -- data to send
is_byte (bool, optional) -- if byte = True : no encoding , defaults to False
- startClient(timeout=0.1)¶
start client
- Parameters
timeout (float, optional) -- timeout in seconds, defaults to 0.1s
- class networking.networking.server(port='2001')¶
Bases:
object
server class
- accept(timeout=0.1)¶
accept client (only one)
- Parameters
timeout (float, optional) -- timeout, defaults to 0.1s
- clientAddr()¶
return client address
- Returns
address
- Return type
string
- close(shutdown=True)¶
close connexion
- Parameters
shutdown (bool, optional) -- if True, also shutdown socket, defaults to True
- readline()¶
read a line from buffer
- Raises
Exception -- if buffer is empty => client disconnected
- Returns
data read without
- Return type
string
- receive(limit, is_byte=False)¶
receive data
- Parameters
limit (int) -- receive limit
is_byte (bool, optional) -- if byte = True : no encoding , defaults to False
- Returns
data in string if is_byte = False, otherwise in byte form
- Return type
string or byte
- send(data, is_byte=False)¶
send data
- Parameters
data (string if is_byte = False, otherwise byte) -- data to send
is_byte (bool, optional) -- if byte = True : no encoding , defaults to False
- shutdown()¶
shutdown socket
- startServer()¶
start server :return: