View Full Version : 127.0.0.1
Unregistered
05-24-2002, 03:07 AM
Hello,
I am reading my first book on network programming. I have a single computer at home, running linux suse. My question is: Can I use address 127.0.0.1 to run my server and client programs or do I absolutely need two machines?
Thanks
stautze
05-24-2002, 04:26 AM
Are you asking if you can have a work station and a server on the same machine. If so the answer is yes.
Unregistered
05-24-2002, 04:46 AM
Not exactly, stautze. What I wonder is whether I can run both a server (say server.c) and its counterpart client (say client.c) on the same machine and make them communicate with each other.
I am not interested in unix domain sockets (AF_UNIX or AF_LOCAL), but internet sockets.
Unregistered
05-24-2002, 08:21 AM
yes, you can...
Lynux-Penguin
05-25-2002, 12:05 AM
clarity is here!
Yes you can, first of all
But it may depend
What it would look like is this
Server (127.0.0.1) -> Client (127.0.0.1) as long as Client supports the address 127.0.0.1, and I see no reason why it would not.
if it is an internet communication you want then I would suggest setting up a masquerade or having the server run on 127.0.0.1 or whatever and have the client actually go through a DNS to your IP, like for example if my internet ip was 24.24.57.231 then I would do this:
[Enter the server IP]: 24.24.57.231
Connecting...
Connection initiated.
Enter command:
etc.
however if I did 127.0.0.1 then it would not go through a DNS or any loops just straight to itself not even touching the ethernet or modem card.
Hammer
05-25-2002, 05:53 PM
>however if I did 127.0.0.1 then it would not go through a DNS or any loops just straight to itself not even touching the ethernet or modem card.
.... which would be a far better thing, mostly if you have a firewall.
If you are running a newly coded server, you really don't want it allowing incoming connections from the net. It is better to keep these things as local as possible until you are sure your code isn't going to allow someone unauthorised access to your system.
hostensteffa
06-01-2002, 04:53 AM
Okay this thread really threw me off. How can you use 127.0.0.1 for an ip. That ip can't really be used as a network node address as it is reserved for the hardware loopback, correct? Or i could just be misunderstanding. Can someone clarify this please.
Hammer
06-01-2002, 01:12 PM
You can use it to connect to your own machine.
If you run a telnet server, start a telnet client on the same box, and connect to 127.0.0.1 ....
Lynux-Penguin
06-02-2002, 01:24 AM
127.0.0.1 is just like any other adress except it starts with 127 and is the NATURAL default for a local address to the same machine like
192.168.1.1 is a natural gateway address
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.