Hi everybody i'm new to stackoverflow and to python programming :-)
Can somebody point me in the right direction or suggest me a good way to do this..?
The software I'd like to write is a kind of "multiple remote control", it has:
One Server ... whose task is to send his screen to all the clients
Many Clients ... they show the Server's screen and they are all able to control it (there exist a lot of remote control applications which can do this,but not all the clients together i think .. practically one server with many mice :p .. however all the clients will be managed by the server)
Given that I'm new to python i started looking and using these libraries:
wxWidget for the gui
Twisted for the network connection, because it's an easy way to implement a multicast UDP .. but is udp the right choise to send images to all the clients? =/
PIL (Python Imaging Libary) images stuff and to grab the screenshots on the Server machine to send to the clients .. this is the point where I stopped to think to all the possible solutions ... (I wasn't able to send the image to the client, I tried converting it to string but the UDP message was not that big :) )
I've seen many suggest the use of a VNC application .. is it easy to develop my software as described around it (actually i have no idea how..), or grabbing the screen continuously with PIL and sending somehow the images to the clients is an acceptable solution?
Thanks in advance for any help :-)
Take a look at the VNC viewer implemented in Python.
Teamtalk is a Python IM software that also has Remote Desktop access. You can download the source and look at the implementation.
Related
This question is more about advice on how to approach the best solution and possible frameworks to look at.
Desired Result
I am currently attempting to create a very basic plug and play raspberry-pi which can be controlled via an API to perform various tasks such as stream a webcam or turn an led on. The device should connect to anyway wifi and automatically be able to be controlled by the API.
Current Problem
The goal of the app is to create a very easy to use plug and play solution. However I am running to to problem when trying to create a WebSocket on the PI as I cannot seem to be able to access it from an external network. I have looked into automatic port forwarding solutions such as UPnP however all of the results are extremely old. I have also thought about creating the Python WebSocket on a cloud server and use the PI as the client to connect and pass data. Please correct me if I am wrong, however this method does not seem very scalable when there are 10s/100s/1000s of pi's connecting to the same socket.
Any advice would be greatly appreciated.
I have a bit of an open ended questions for you all. I wish to create a simple chat-room such as this example here: https://www.geeksforgeeks.org/simple-chat-room-using-python/ but I am lost as how to do it over the internet rather than just local network.
Any pointers/help would be appricated!
Thanks :)
There are multiple ways about this. You can either:
Run locally and expose your Python chat system to the internet.
Run your Python chat system in some online server provider (Heroku, AWS, etc.).
The first method requires you to do some port-forwarding on your local network, essentially mapping your 127.0.0.1:8081 local server to your public IP (so you would connect via the internet as myip:8081). This method, however, comes with its limitations; when you turn off your computer you are also effectively turning off your server to the rest of the internet. The second method will ensure the server stays on at all times, and is likely what you are looking for. Heroku is a great starting point as they provide a free tier that you can test everything out.
Goal
I have made a website using the Flask framework and am fairly comfortable with HTML, CSS, JS, Python. My goal is to connect an arduino to the client's PC's usb port and use serial.write() to send a number to it.
Notes
I have a working example of interfacing with python if arduino was connected to the server.
import serial
ser = serial.Serial('COM4', 9600)
ser.write('5')
Now I want to run these exact 3 lines on the client side.
Is this even doable? I have researched a lot and it seems that this is not doable due to security reasons? (I'm hoping somebody proves me wrong here.) That is why I'm looking for a workaround. But before that I must mention, I don't need any of the data (numbers) to come from the server. Once the webpage is loaded all serial communication that I need is on the client side.
Client side python: I have looked into writing python on the client side and read about skulpt and PyPyjs but am not sure how I could run the mentioned 3 lines with them on client side(neither seems to support pyserial needed for import serial or at least I have not had any luck finding documentation)
I also looked into arduino documentation for interfacing with software but it seems that all the languages mentioned are server side. If you know of any possible direction languages that could help, I'd be happy to know and go learn them. I saw many forums mentioning Node.js but my understanding is that would also only do the job on the server side.
I'd appreciate any help on where else/other topics I should look into. Thanks in advance.
Is this even doable? I have researched a lot and it seems that this is not doable due to security reasons?
You are correct. There is no ability for browsers to access a COM port. It doesn't matter what language or framework you pick, a browser isn't going to give you that access.
You would need to make a standalone desktop application. You can use HTML and JavaScript to access serial ports, just not in a browser. Chrome Apps (which are actually going away) can do it, as well as an App that uses Electron.
I am trying to create a secure chat server with python, and after many hours of hunting all I have discovered is that I should use SSH, and that Paramiko seems to be the best python module for it (I may be wrong). I cannot find out how to implement this though, and being quite new to Python, the docs were a bit deep for me, especially as I didn't really know what to look for!
Any links to example code would be greatly appreciated, especially concerning the server (there seems to be hundreds of examples about connecting to an ssh server, but none about creating them - am i missing something vital here? I have heard that it is possible to create an ssh server in python, but the apparent lack of code on the internet is worrying me)
Thanks
EDIT:
My ultimate goal is to create a secure chat client with python, and I would like to keep it as simple as possible, however, security is the main goal. I have seen and made several chat clients in the recent past, however, they required telnet to connect to them, so were not secure, I wish to correct this.
Try Twisted, an asynchronous networking engine written in Python. They have a very simple example called chatserver.py. Get that running and then make it listen on SSL using a self-signed SSL certificate.
Here is another example.
I was wondering if you could help me with some programming. I'm trying to write a chat program but i'm stuck. I can use LAN easily enough, but I cant do it over WAN / the Internet as an external IP-address only refers to the Lan/router. how can you connect to one computer in particular?
I'm trying to write in Python, but ive ran into a problem. i'm using a very basic client-server system using the socket module for both (so far).
The problem i'm having is that, while connecting over LAN is easy enough, i need to connect over the internet to one computer. This is because the external IP is only referring to the router. I know i could use probably port-forwarding but i was wondering if there was a way to reach the individual computer without the user manipulating router settings.
There's something called NAT Traversal. But it's not standard at all and there are may ways to do it, depending on the router vendor and other things. So it's a very complex thing to implement in a generic manner.