I am working on a GUI program to command power supplies by Ethernet.
I have the DHCP of my computer activated, therefore I guess that the IP adresses of my power supplies are fixed by my computer.
I would like to know the IP addresses of my power supplies, in order to communicate with them through the TCP/IP protocol, using Python.
For the moment, I use a program called LXI discovery tools, and while I run it, the Window command arp -a command gives me the IP adresses of my power supplies.
The problem is that I need to run this LXI program. Is it obligatory?
Owing to the DCHP, my computer is the one which sets the IP addresses, therefore isn't there a way to get those addresses more easily?
Moreover, is the Python socket library able to help me?
Finally I solved my problem, using statique IP addresses. Therefore I know them and I don't need anymore to "scan" my network.
Related
I'm trying to use socket to exchange data between two computers in Python. Right now, I'm able to connect the computer together but I have to manually go in the code and specify the IP address of the other computer. However the code needs to be fully autonomous on boot. How should I do that? Is there a way in python to achieve this? Thanks.
I am wondering if there is a way to monitor all data flow from the ports of an IP that might not be in my local network. I prefer doing this in Python and/or command line. Thank you.
I'm thinking you might want to try nmap, which is for command line. https://nmap.org/
"Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts."
I've been doing the programming for a start up company I know to get some experience. I've been told I'll need to relay data from my original piece of software running on one computer to 8 others using ethernet. Bear in mind I haven't really done much network stuff before.
I see that I'll need the python socket module so I've learned a bit of that. I also get that I'll need a network switch hardware-wise.
What I'm unsure about is how I set up the network in the first place. I get that I can do this via Device Manager but setting all computers to the same subnet and different IP addresses. However, the idea is that people will bring their laptops to be connected, so I don't want to have to mess around with each laptop to connect it to the network. So is there a way of doing this directly in Python so that I can just write it in the program that I'll have running on each laptop?
Thanks!
You need a DHCP server and people's NIC's to retrieve their network configuration automatically.
Windows:
netsh interface ip set address "Local Area Connection" dhcp
Debian (/etc/network/interfaces):
auto eth0
iface eth0 inet dhcp
Red Hat (/etc/sysconfig/network-scripts/ifcfg-eth0):
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
I suppose you could use Python or whatever language you're convenient in to fetch the relevant interface's name, as they're not guaranteed to be named "eth0" or "Local Area Connection", e.g. subprocess.Popen("cat /proc/net/dev/").
I need to transfer data via pyzmq through two computers connected by an ethernet cable. I have already set up a script that runs on the same computer correctly, but I need to find the tcp address of the other computer in order to communicate. They both run Ubuntu 14.04. One of them should be a server processing requests while the other sends requests. How do I transfer data over tcp through ethernet? I simply need a way to find the address.
EDIT: (Clarification) I am running a behavioural study. I have a program called OpenSesame which runs in python and takes python scripts. I need a participant to be able to sit at a computer and be able to ask another person questions (specifically for help in a task). I need a server (using pyzmq preferably) to be connected by ethernet and communicate with that computer. It wrote a script. It works on the same computer, but not over ethernet. I need to find the address
Tcp is a protocol that uses an internet connection to Transfer data, through an IP address and specific port, you have to ensure that those ip directions are in the same range and uses the same port. For example: one pc 192.168.1.50 and another pc 192.168.1.60 in 502 port. The easiest way is using a Modem and set an statical address for each pc.
In the following link, you can find easily in which ip direction is connected your Computer. http://www.howtogeek.com/howto/17012/how-to-find-your-ip-address-in-ubuntu/
Maybe you could periodically send datagram message containing peer's ip address (or some other useful information) to broadcast address, to allow other peers to discover it. And after peer's address is dicovered you can estabish connection via ZeroMQ or other kind... connection. :)
Basically what I'm trying to achieve is a program which allow users to connect to a each other over a network in, essentially, a chat room. What I'm currently struggling with is writing the code so that the users can connect to each other without knowing the IP-address of the computer that the other users are using or knowing the IP-address of a server.
Does anyone know of a way in which I could simply have all of the users scan the IP range of my network in order to find any active 'room' and then give the user a chance to connect to it?
Also, the hope is that there will be no need for a central server to run this from, rather every user will simply be connected to all other user, essentially being the server and client at the same time.
I can give you two suggestions. First of all, UDP packets to the broadcast address of your network will be received by everybody. Secondly, there is a protocol for programs offering certain services to find each other on a local network. That protocol is called mDNS, ZeroConf, or Bonjour.
Using broadcast UDP is likely going to be the faster route. But if I were you, I'd learn how to use ZeroConf instead. It's supported well under IPv6 and already used by several interesting programs such as SubEthaEdit and Gobby.
Here is a link to a nice tutorial for implementing something that speaks ZeroConf in Python.
Another recommendation... If you want to hand roll your own broadcast/multicast UDP code and you can be sure that all of the systems you're on are running a Linux that's newer than 2003 or so, and all the Windows systems are XP or better, you can probably get away with using IPv6. The IPv6 link-local (think same LAN) all hosts multicast address is ff02::1. That's really simple and easy, and it will reach all the other systems on the same LAN. It's much better than having to figure out what your network's broadcast address is with IPv4.