Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Socket extension

Project description

—- sockData - send other data types via socket —-

This library can send other data types than just strings with socket. You can normally only send strings with socket. But with this library, you can send all data types that are supported by pickle.

How to use it:
Sending:
instead of ‘<yourConnectedSocket>.send(<string>.encode())’ type: ‘import sockData.send sockData.send.sendData(<yourConnectedSocket>, <data>)’
Receiving:
instead of ‘<yourConnectedSocket>.recv(<bufferSize>)’ type: ‘import sockData.receive sockData.receive.recvData(<yourConnectedSocket>, <bufferSize>)’

Examples:

server.py:

import socket import sockData.receive

sock = socket.socket() sock.bind((“”, 50505)) sock.listen(1)

client, addr = sock.accept()

dictionary = sockData.receive.recvData(client, 1024) print(dictionary)

client.close()

client.py:

import socket import sockData.send

sock = socket.socket() sock.connect((“127.0.0.1”, 50505))

dictionary = {“message”: {“from”: “127.0.0.1”, “msg”: “hello!”}} sockData.send.sendData(sock, dictionary)

sock.close()

Project details


Release history Release notifications

This version
History Node

1.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
sockData-1.0.1-py3-none-any.whl (2.7 kB) Copy SHA256 hash SHA256 Wheel py3
sockData-1.0.1.tar.gz (1.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page