|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
search network
if there are 10 versions of my program each on different pcs in an intranet, how could i get one of the programs to search for the other computers? all the pcs are windows systems. assuming we don't know how the pc's are connected. is there any thing in windows to connect to which searches computers?
i really dont understand how this could be done? cus there are soooo many possible ip addresses that a computer could have - could python change the ip of a computer, then the computer that's doing the searching can search for premade values? Ta. |
|
#2
|
|||
|
|||
|
Changing the IP address is a big no-no. It would break every other application on the PC that used the network, and cause no end of problems.
There are a few solutions that come to mind. 1) The first is to have one system that acts as a name server - the other PCs have to be given the address of this system, and they register with it when they start up. They can then query it to find out where all the others are. This is essentially how systems like CORBA work, and even the internet itself. If you use CORBA for communicating between hosts then you should get a name server as part of the CORBA framework. I have used omniORB which has very good Python support. 2) The next solution is to send broadcast or multicast packets out asking for the other programs to respond. This requires knowledge of low level socket programming. You should get an assigned port number from the IANA so that you know which port to listen on for your other applications' broadcasts. You will also need to define a protocol for your applications to talk to each other. 3) Windows has an API for finding the other Windows systems on the network - this is what is used when you browse 'Network Neighbourhood'. You could use the Win32All extensions to get a list of available systems on the network and interrogate each one for your application. This has two disadvantages: (a) it is SLOOOOOW. (b) If a PC does not have network sharing enabled it may not appear on the network list. I have used both (1) and (2) in the past, and on balance I would recommend going with (1) if you can. Dave - The Developers' Coach |
|
#3
|
|||
|
|||
|
thanks alot devcoach - and everyone else that answers to my posts, the python forum seems so much more helpfull than any of the others here.
|
|
#4
|
|||
|
|||
|
so how could i go about creating my own name server then? I found a post on devshed but it was going on about buying domain names. all i need is the facility for my computers to be able to recognise each other.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > search network |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|