Skip to main content

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

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

License

This project is licensed under the MIT License

Project details


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

easy_tcp_python2_3-0.0.1.0-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

easy_tcp_python2_3-0.0.1.0-py2-none-any.whl (2.9 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page