easy socket programming between python 2 and 3 without compatibility issues
Project description
easy-tcp-python2-3
- easy socket programming between python 2 and 3 without compatibility issues
- receive and send the list, json or image via pickle and cv2 (jpeg)
Dependencies
- python 2 or python 3 (>=3.7)
- opencv-python
- pickle-compat
Installation
$ pip install easy_tcp_python2_3
Usage
- send a sample list and image from a server to client
# server
from easy_tcp_python2_3 import socket_utils as su
import numpy as np
sock, add = su.initialize_server('localhost', 7777)
sample_list = [1, 2]
print("Send list:, sample_list)
su.sendall_pickle(sock, sample_list)
sample_image = np.uint8(np.zeros([480, 640]))
print("Send image:, sample_image.shape)
su.sendall_image(sock, sample_image)
# client
from easy_tcp_python2_3 import socket_utils as su
sock = su.initialize_client('localhost', 7777)
recv_list = su.recvall_pickle(sock)
print("Received list:", recv_list)
recv_image = su.recvall_image(sock)
print("Received image:"recv_image.shape)
Authors
- Seunghyeok Back seungback
License
This project is licensed under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for easy_tcp_python2_3-0.0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99fcc50a828e1812338fd7803d4d684925d99a92b33e5136b5561be87ea4bc74 |
|
MD5 | 520fd78d9135238bebc18c8509c93906 |
|
BLAKE2b-256 | 1cd016a155e6c8b67367c5473c6dec28e853d18de1b494294ddc4c387f96c1d8 |
Close
Hashes for easy_tcp_python2_3-0.0.1.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71caa97660074a952da8d1d796efe1915e4fa3b636c9675ae5995965f880c38e |
|
MD5 | 8e03e9570c8941f19d7230c072027f5b |
|
BLAKE2b-256 | f7d7fd6fd06addf6b726e1e0c1524c7cb4533f5e0b555f1e4e3641ac4ecd4a4a |