Friday, March 9, 2007

Accessing localhost through the network...

Have you ever tried accessing your localhost through other machines in the network???

Localhost :~ Now wats that???

In computing, in the context of a TCP/IP (Transmission control protocol/Internet Protocol) network such as the Internet, localhost is a reserved name meaning this computer, which means your local computer.

Still not clear ???

I will try and explain in a simpler manner. Suppose we open Internet Explorer, we open google and then search for some thing. Wat happens as soon as we click Search ? Actually what happens is the request from you is sent to the server (Google in this case), which inturn queries its database and then returns the response back to you in the form of result page. So here Google has some server(s) in the backend. There are different types of servers, Web Servers, Application Servers, Map Servers etc etc.... that take requests through different mediums and prcoess them, return the output and wait for the other request.

Where the hell does localhost come into picture in all this ?

Coming to Localhost, Its a Web/App server installed on your machine to make it look and function like the one in reality, As soon as we install a web server like Apache Tomcat or many other servers available, a server starts running on our system, Microsoft XP comes with a default web server called the IIS server, which stands for Internet Information Server. It has to be explicitely installed from the windows disk, Once we have installed the default address we get is

http://localhost or
http://127.0.0.1 or
http://your computername

and the port is 8080

Can we have multiple servers running on one system ?
Suppose we have many servers running on the system, like Apache Web Server, Apache Map Server, Zope1, Zope2, Zope3, Oracle Application Server, etc .... (These many servers run on my system at a time)

What happens is that we can have multiple ports assigned to these services, They have unique port addresses from 8080 to some value (I dont remember exactly) but i have like 8025, 8045, 8055, 8855, 8080, ports assigned for the different services running in my system.

And how do we access these services (localhosts) through the different machines in the network?

Its simple,

say your IP is 10.10.125.3 and you want to access this machines localhost from some other machine with another IP say : 10.23.52.4

So what you do is, on the other machine type the machines ip address which is to be accessed, in this case its your localhost (machine) i.e. http://10.10.125.3 and specify the port which is to be accessed

i.e.

http://10.10.125.3:8025/aa.jsp

thats it !

If you have firewalls enabled in your windows xp system you will need to configure it to open the ports that are to be accessed in the network. That is done as follows:

Go to control panel > Windows Firewall > Exceptions
(see illustrations below)

in that add the port number and the service name and you are through, now your local host website can be accessed through the network.

Theres an alternate to this setting as well,

Go to Network Connections > Properties > Advanced > Internet Connection Firewall (Check it if Unchecked) and down ther is a settings tab in that

Settting > Services > Add a service port and service name,

Done....






























2 comments:

Unknown said...

hi how can different ports can be assigned?explain

Anonymous said...

It is very useful to beginners like me
thank u
dude