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 IMPORTANT NOTE: It is not finished, so expect errors, a lot of missing stuff
cpp_python_socket
Simple TCP/IP socket comunication wrapper between c++ and Python for IPC.
General Information
For how to install c++ package & more info check the repo: https://github.com/OleguerCanal/cpp_python_socket.git`
Usage examples
Python Server:
from CppPythonServer import Server
if __name__ == "__main__":
server = Server("127.0.0.1", 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)
cv2.waitKey(1000)
server.send("Okioki")
C++ client:
#include <iostream>
#include "client.hpp"
int main() {
socket_communication::Client client("127.0.0.1", 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");
client.SendImage(img);
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.
Source Distribution
CppPythonSocket-0.1.3.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for CppPythonSocket-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02c7f549d4913f46d4518dc3fdcb027f9ae0465b3abc8217af9a3846c10ff51c |
|
MD5 | 91326eeafb2385d64d3afd39d2dccf8d |
|
BLAKE2b-256 | a6246880e7a5a437827606154748a3079ca57850908b730622351e5db377b82a |