Skip to main content

Simple TCP/IP socket comunication wrapper between c++ and Python for IPC.

Project description

IMPORTANT NOTE: This is more an exercice for me to learn how to make installable packages than an actual useful package. It is not finished, so expect errors and a lot of missing stuff.


Simple TCP/IP socket comunication wrapper between c++ and Python for IPC.

General Information

To install c++ package, read/edit source code and more info check out the repo:

Usage examples

Python Server:

from CppPythonSocket import Server
import cv2

if __name__ == "__main__":
  server = Server("", 5002)

  # Check that connection works
  message = server.receive()
  print("[CLIENT]:" + message)
  server.send("Shut up and send an image")

  # Receive and show image
  image = server.receive_image()
  cv2.imshow('SERVER', image)

C++ client:

#include <iostream>
#include "client.hpp"

int main() {
    socket_communication::Client client("", 5002);

    // Check that connection works
    client.Send("Hello hello!");
    std::string answer = client.Receive();
    std::cout << "Server: " << answer << std::endl;

    // Load image and send image
    cv::Mat img = cv::imread("cpp/lena.png");
    std::string answer2 = client.Receive();
    std::cout << "Server: " << answer2 << std::endl;

Project details

Download files

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

Files for CppPythonSocket, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size CppPythonSocket-0.2.2-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size CppPythonSocket-0.2.2.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page