Skip to content

SeungBack/easy_tcp_python2_3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-tcp-python2-3

Maintenance PyPI version PyPI license Hits Python 2.7 Python 3 contributions welcome

  • 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

About

easy socket programming between python 2 and 3 without compatibility issues

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages