module documentation
File containing functions for communication with Socket !
Function | create |
Everything in the title |
Function | data |
Convert a string representing a JSON to a JSON |
Function | dict |
Convert dict to packet |
Function | receive |
Receive msg which cannot be contained in only one buffer |
Function | receive |
Receive json through a Socket |
Function | receive |
Receive json through a Socket then extract payload content. Payload can typically be an heavy file like an image |
Convert a string representing a JSON to a JSON
Parameters | |
data | String representing a JSON |
Returns | |
Optional[ | dict of this JSON |
Receive msg which cannot be contained in only one buffer
Parameters | |
sckt | the socket |
packet | Format de l'objet du message : permet de savoir sur cb de bytes est codee la taille |
buffer | buffer size for reading socket's buffer |
Returns | |
Optional[ | Bytes corresponding to received packet ! |
def receive_dict(sckt, packet_size_infos=DEFAULT_PACKET_SIZE_INFOS, buffer_size=READ_SIZE) ->
dict
:
¶
Receive json through a Socket
Parameters | |
sckt | the socket |
packet | Format de l'objet du message : permet de savoir sur cb de bytes est codee la taille |
buffer | buffer size for reading socket's buffer |
Returns | |
dict |
def receive_dict_w_payload(sckt, packet_size_infos=DEFAULT_PACKET_SIZE_INFOS, buffer_size=READ_SIZE) ->
( dict, bytes)
:
¶
Receive json through a Socket then extract payload content. Payload can typically be an heavy file like an image
Parameters | |
sckt | the socket |
packet | Format de l'objet du message : permet de savoir sur cb de bytes est codee la taille |
buffer | buffer size for reading socket's buffer |
Returns | |
( | dict of packet's JSON, payload |