https://github.com/mdebbar/jsonsocket
This is a small Python library for sending data over sockets.
https://github.com/mdebbar/jsonsocket
Last synced: about 2 months ago
JSON representation
This is a small Python library for sending data over sockets.
- Host: GitHub
- URL: https://github.com/mdebbar/jsonsocket
- Owner: mdebbar
- Created: 2014-04-26T01:52:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-01-16T14:55:31.000Z (over 6 years ago)
- Last Synced: 2025-03-28T23:11:20.271Z (2 months ago)
- Size: 165 KB
- Stars: 52
- Watchers: 10
- Forks: 34
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jsonsocket
==========This is a small Python library for sending data over sockets.
It allows sending lists, dictionaries, strings, etc. It can handle very large data (I've tested it with 10GB of data). Any JSON-serializable data is accepted.
Examples:
```python
from jsonsocket import Client, Serverhost = 'localhost'
port = '8000'# Client code:
client = Client()
client.connect(host, port).send({'some_list': [123, 456]})
response = client.recv()
# response now is {'data': {'some_list': [123, 456]}}
client.close()# Server code:
server = Server(host, port)
server.accept()
data = server.recv()
# data now is: {'some_list': [123, 456]}
server.send({'data': data}).close()```