Results 1 to 8 of 8
- 05-26-2011, 08:03 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 93
- Rep Power
- 0
How do I find out what I.P address to give to a Socket?
I've just started learning about Servers and Sockets.
I made a client program which I run in one cmd window (on Windows 7)
and I made a server program which I run on another cmd window.
How do I find out what I.P address to give to my client program? I really don't know much about servers so please keep it simple. I do know how to use a command line.
- 05-26-2011, 08:06 PM #2
Member
- Join Date
- Jan 2011
- Posts
- 93
- Rep Power
- 0
My server has a local host address of I.P is 0.0.0.0/0.0.0.0.
I've given the client an I.P of 12.12.12.12
The connection always times out.
- 05-26-2011, 08:10 PM #3
If both programs are on the same machine, then use the localhost address: 127.0.0.1
The client would use the localhost address to connect to a server on the same machine.
- 05-26-2011, 08:18 PM #4
Member
- Join Date
- Jan 2011
- Posts
- 93
- Rep Power
- 0
Totally worked. So for any PC in the whole entire world, the address of the computer you're working on is 127.0.0.1 (irrespective of Operating System)?
- 05-26-2011, 08:20 PM #5
I think that is supposed to be the standard, but I don't know for sure. I've only worked on Windows and Ubuntu. I think it also works on Macs
- 05-26-2011, 08:22 PM #6
Member
- Join Date
- Jan 2011
- Posts
- 93
- Rep Power
- 0
I see. One more question : how can i access my server from my browser? Is that even possible?
- 05-26-2011, 09:04 PM #7
Yes you can. I do it all the time with my test server. Enter a location of:
http://127.0.0.1:<porthere>
Where <porthere> is the port number the server is listening on. Default is 80. So if you're using the default:
http://127.0.0.1
- 05-27-2011, 03:17 AM #8
The IPv4 loopback is 127/8 (127-dot-anything). The IPv6 loopback is ::1 (0:0:0:0:0:0:0:1). Your hosts file probably contains an entry for "localhost" that maps to one of these. So, for example, you could use the URL "http://localhost" (optionally with a port number) to connect to a HTTP server on your own computer.
Get in the habit of using standard Java naming conventions!
Similar Threads
-
Cannot find a free socket for the debugger
By poojadgupta in forum EclipseReplies: 0Last Post: 05-04-2011, 07:16 AM -
Socket and how to launch thread for receiving socket messages
By newbiejava in forum New To JavaReplies: 1Last Post: 07-02-2010, 01:18 PM -
Give me some Assigment please
By mindblaster in forum New To JavaReplies: 2Last Post: 02-05-2010, 09:05 PM -
append response to the request from Socket and write to another socket
By vaibhav_singh_vs@yahoo.co in forum NetworkingReplies: 3Last Post: 04-17-2009, 07:02 PM -
Please give me a solution
By ivvgangadhar in forum AWT / SwingReplies: 5Last Post: 11-14-2008, 01:43 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks