Tunnel serial com port windows 10 - python

I'm currently developing a python automation which communicates and control FPGA platform via serial com port. The platform connected to a PC setup in the lab at my workplace. to connect to the FPGA with Python i'm using pyvisa as follows:
import pyvisa as visa
rm = visa.ResourceManager('#py')
self.inst = rm.open_resource('ASRL8::INSTR')
my problem:
To test my code I must pull the new code to the lab-PC.
Is there a way that i'll "tunnel" the serial com port so I can can connect to the FPGA from my PC over LAN ? or any other method that will enable me to connect to the FPGA platform using my development PC ?
*an additional hardware can be considered if needed...
'ASRL8::INSTR' --> 'TCPIP0::LABPC-IP::inst0::INSTR'

Yes, that is called Virtual Com Port, VCP, and can run both TCP and UDP.
Search for "Virtual Com Port TCP" for instance and you get a lot of software you can install to manage that.

Related

Python 3 bluetooth connection ports

AFAIK bluetooth uses profiles to determine which type of device it should connect to.
Using Pyhton3 i can create a socket server to bind to a port, but where do the profiles go?
I am trying to connect to my phone using this app, but i cannot set a port there: https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=de&gl=US
I can't find any code in python managing the bluetooth profiles. AFAIK the app uses the serial profile, but is that what python sockets are?

Python DHCP enabled disabled check

I'm using Python 3.8.5 currently on windows, but the script should run also on linux and on macOS.
I'm creating UDP server and a client and have establish communication between them via multicast.
The client does not know from advanced the IP of the server so it is a "discovery tool" that will let me know information about the server ones it has received the data. -This is working-
On the server I'm using netifaces to get information about the interfaces.
The server sends information to the client such as IP address, mask, gateway. -information that I get from netifaces and is working-.
Example of data I get:
Now to the issue:
The python server can have a static IP or can be connected to a DHCP server -in case that is connected to a DHCP server I will not have access to the DHCP server-.
I wish to know when the DHCP is enabled or disable on the python server so I can send this as a flag to the client together with the rest of the information.
The idea is for the client to know that the IP that he's connecting to can change and he may lose connection and will need to start the discovery tool once more.
Because the user will not know in advanced if the python server is connected to a DHCP server or wil know the IP address of the python server or have access to the python server command line or configuration, using ip addr show, ipconfig, ifconfig and other commands before connecting is not an option.
I have seen that people use scrapy for DHCP communications but it seems that it does not solves what I wish to accomplish.
I do no need to configure the DHCP, just detect if my python server IP is static or dynamic.
I have search for over 4 days and have not found a possible solution.
I'm not asking to have the solution in silver spoon just to be pointed on the right direction.
**EDIT: I forgot to mention that the python server will be running on Ubuntu 16.04 and 20.04.
This will depend on your operating system setup. For example, here's a related question on how to detect whether DHCP is enabled in Ubuntu.

BlueZ DBUS API - GATT interfaces unavailable for BLE device

I have a BLE device which has a bunch of GATT services running on it. My goal is to access and read data from the service characteristics on this device from a Linux computer (BlueZ version is 5.37). I have enabled experimental mode - therefore, full GATT support should be available. BlueZ's DBUS API, however, only provides the org.bluez.GattManager1 interface for the connected device, and not the org.bluez.GattCharacteristic1 or org.bluez.GattService1 interfaces which I need. Is there something I'm doing wrong? The device is connected and paired, and really I've just run out of ideas as how to make this work, or what may be wrong.
If it helps, I'm using Python and the DBUS module to interface with BlueZ.
A system update resolved this problem.

Can we communicate with Xbee from host programatically

I am trying to hook up a xbee on arduino and wish to run some algorithms on my linux machine and based on result of algorithmic output i ahve to communicate the commands to xbee connected to my arduino. I know we have API support to read/write xbee from Arduino platform. Does Xbee have a way to be programmed on host machine running Linux/OSx other than x-ctu software.
I wish to know if there is a way to programmatically communicate Xbee using USB dongle adapter from host machine, may be python api
I found this online http://serdmanczyk.github.io/XBeeAPI-PythonArduino-Tutorial/ and it pretty much addresses my need .

How do I force close a port being used by an independent service?

For example, if I have my minecraft server running on port 25565, I want to have a python script close the port so that all connections will be dropped and no further connections will be made without having to shutdown the service.
I have tried binding a new socket to the same port number and then closing the socket, but it does not have any effect on the server.
I am working in Python 3.3.
Use a firewall for example?
On linux there is the iptables. It's easy to use and powerful.

Categories

Resources