Connect ZKTECO device from hosted django Site gives an error - python

I have created a site that connect ZKTECO K40 device. The connection Method is pretty simple:
from zk import ZK, const
zk = ZK('192.168.1.13', port=4370, timeout=5)
conn = zk.connect()
This makes a connection while running from a local host connecting in the same network.
But after hosting the site, the site is not able to ping to the device and cannot connect to the device.
How can I connect to the device connected on pc local network from a hosted django site? I have my site hosted on Cpanel.

From the server, a machine which is connected to some local network can not be connected. You have to use cams biometric api for communicating your biometric device from the remotely hosted application.

You can use https://www.zerotier.com/ - to expose the device over the internet and then connect it. It's not advisable. but thats one way.

Related

Connecting to Redshift via psycopg2 fails

I have whitelisted ec2 IP address but without 0.0.0.0/0 configuration, I can't connect to the Redshift database from psycopg2. What can be done about this situation where we want to request from a particular IP address.
Is this is the bug that exists when you try to connect it programmatically
Edit:
I tried to whitelist my local IP address and ran my program on the local server and it got connected. But I am not able to connect via my application hosted on EC2 instance.

How can I acces to my database in localhost from android - Kivy/Python

I'm working on a project using Kivy/Python and PostgreSql so I faced a problem I don't know how can I access to my database from android, (localhost) in laptop it works good but on android phone I don't know how can I access to localhost, I tried to deploy my app to my phone using USB cable. what I should please can someone give me an idea about it. Thanks
Localhost is used to access the network services that are running on the host via the loopback network interface. So no other devices can connect to it.
One solution for you to be able to access your database from your phone is by enabling the database to listen on all interfaces. This can be enabled by changing postgresql.conf listen_addresses in postgresql.conf which allows incoming connections on all available IP interfaces.
listen_addresses = '*'
Make sure you restart the postgres process after changing the configuration.
If your phone is on the same network then you can set the project setting to the computer IP address that is running postgres.

Problems with exposing Kafka to outside network on Google Cloud

It is still a mystery to me how to expose Kafka to external network. I deployed Kafka on google cloud virtual machine using "Kafka certified by Bitnami", which runs Kafka 2.3.0 and Zookeeper 3.5.5. I opened firewall on ports 9092, 2181 (yes I can telnet it) and assigned static IP address to my machine. My server.properties file looks like this:
listeners=SASL_PLAINTEXT://:9092
advertised.listeners=SASL_PLAINTEXT://<static_ip>:9092
zookeeper.connect=localhost:9092
I tried to connect from Python:
from kafka.admin import KafkaAdminClient
import logging
logging.basicConfig(level=logging.DEBUG)
admin_client = KafkaAdminClient(
bootstrap_servers="<static_ip>:9092",
client_id='test',
sasl_plain_username="bitnami_provided_user",
sasl_plain_password="bitnami_provided_password"
)
What I get is this Error: Closing connection. KafkaConnectionError: socket disconnected.
I also changed SASL_PLAINTEXT to PLAINTEXT and then I get NoBrokersAvailable Error.
I went through this thread Not able to connect to kafka server on google compute engine from local machine and tried to make the same, but without luck. Is this really so difficult to expose Kafka to external network? I just want to access it from home and my local computer.

How to connect Choregraphe/Python script to remote Pepper robot from different network?

A robot is connected to a network with restricted outbound traffic. Only inbound traffic is allowed from one specific IP address(ours IP, e.g. 111.111.111.111). All outgoing traffic is forbidden.
There is settings and dhcp corresponding to external IP(e.g. 222.222.222.222). We want to connect to Pepper from the IP 111.111.111.111. The connection through SSH is fine with ssh nao#222.222.222.222 and password but we can not connect through Choregraphe or Python scripts. This is very important because we want to be able to connect with the robot remotely to upload different Choregraphe applications.
This is the error when we are trying to connect with a Python script:
[W] 18872 qimessaging.transportsocket: connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
...
RuntimeError: Failed to connect to service ALBehaviorManager on machine 1296211e-1921-3131-909b-69afa37ааа28. All endpoints are unavailable.
The Choregraphe hangs and crashes after a certain period of time.
Can you give me some advice?
NAOqi connections go through port 9559 by default, so you could check whether that one is blocked.
If you are unable to connect through port 9559, you can do a port forwarding. But I think this is a more network related question.

Client server communication over hosted network

Okay I'm a bit new to network programming. We have a site running over a hosted network with a static IP. We want to send some information to the client's PC who connects or logs into the website. Normal sockets are not working as we're getting an error 'refusing connections'. The sockets work in the same subnet but not over internet. How do we connect to the client's computer via server. Are there any libraries for that? Plus the server needs to serve multiple clients who are connected.

Categories

Resources