Raspberry Pi unable to connect to Windows Websocket - python

I am attempting to send data from a Python script running on a Raspberry Pi to a Java Micronaut ServerWebSocket running on a Windows machine, but I am getting asyncio.exceptions.TimeoutError errors during the process.
I attempted to use the websockets library in Python on the Raspberry Pi to establish a websocket connection, but encountered a ConnectionRefusedError. Is this issue related to a network problem as mentioned here, and should I ask somewhere else like Superuser or Serverfault? Or is there another solution to this problem?

As #life888888 suggested, it had something to do with Windows firewall.
But instead of the public firewall being the problem, it was the one for the domain network instead.

Related

I get a com3 error when trying to tun my raspberry pi pico in thonny

So I was trying to code with my raspberry pi pico. I loaded up thonny (with micropython) and I get this error.
Unable to connect to COM3: port not found
Backend terminated or disconnected. Use 'Stop/Restart' to restart.
The only reason I think this would happen was I tested the pi on a battery pack (using it somewhere not near my computer, or another computer, so it was necessary.) How do I fix it?
If you are using a battery pack, that tells me you don't have the Pico connected to the computer with the USB cable. (If so, it is dangerous to have 2 power sources without protection, like a diode.) Is that correct? If so, there is no COM port for Thonny to connect to.

Executing code.py on Raspberry PI, from computer via ethernet connection

How could I launch code.py that only exists on a raspberry, from a python command line on a computer connected by an Ethernet cable. Machine A and the raspberry are connected to each other by a simple ethernet cable, and none of those two endpoints are connected to the internet. They only have the latest version of python installed and can't have anything more installed on them.
It looks like subprocess.Popen() could be a way to tackle it. But with the little knowledge I have I can't understand and know for sure if using this method is suitable !
Thank you for your time :)

mqtt on esp8266 with micropython

I have a modem and four Esp8266 and a Raspberry Pi. I want to control Esp with Python language via internet. I have read this project.
https://randomnerdtutorials.com/micropython-mqtt-esp32-esp8266/
Instead of ESP2, I implemented the code on Windows. But I got the error ModuleNotFoundError: No module named 'ustruct'.
Is there a way for me to remotely check the Raspberry Pi and ESPs using Windows?
Of course I want to use MQTT.
This photo shows what I have described.
ustruct is a MicroPython Module that is available on all if not most MicroPython firmwares ( including the Win32 version of MicroPython)
If you need to / want to port your code to Cpython (on windows or other) that should not be too much work as the two are quite compatible.
as your project needs network capabilities using the Windows port of MicroPython is not an option as neither the Unix nor the Widows ports come with a network stack you compile/download a windows port of MicroPython

OSError: 118 with esp32

I am currently working on a code in micropython using the esp32, and getting an error messeage that says "OSError:118". if anyone is familiar with the problem I,d be happy to get help. I'm using pycharm and the socket library.
im creating a very basic client-server connection. the server runs on python, the client is the esp32. when I ran the code with two computers it worked.
Your network/wifi is not connected. Make sure you have a successful connection to the device as it is not active.

How do I communicate to NodeMCU module through python?

Basically I want to be able to send instructions for a bot over WiFi using the nodeMCU module, but I cant find any detailed functions list that can help me.
I've already tried setting up a server on the NodeMCU, and then a html webpage can then be created on my laptop with buttons for instructions from this and it works, but when I try to to the same on python, (send GET requests through python) I get this error on trying to do more than one request:
ConnectionError: ('Connection aborted.', ConnectionAbortedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None))
Also I think the converse would be better suited for my case, a server on the laptop and client as the module, but I don't know where to start.
I coded the on the module using arduino IDE and on my laptop I'm using spyder. For sending requests and stuff I'm using the requests package.
You can create HTTP endpoints in nodeMCU and call them from your python script.
For this to work, both the nodeMCU and the machine running the python script has to be in the same network. and the IP address of the nodeMCU should be correctly added in the python script.
If you wanted to use your laptop as the server, I would suggest going with an MQTT broker such as mosquito, and communicate between the nodeMCU and the python script using the MQTT protocol.

Categories

Resources