On 11/12/05, <b class="gmail_sendername">John Walton</b> <<a href="mailto:westside_indie@yahoo.com">westside_indie@yahoo.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div> Hello again! I'm still working on that instant messenger
(for science fair), and I have been reading about networking in some
Java tutorials. In one part of it, it said to have a connection with
another computer, you need to know the IP name of the computer you want
to connect with. I don't know whether or not this is the same for
Python, but could someone please tell me what information of the
computer you want to connect with the you actually need for a
connection? In other words (or plain english), what information do I
need to get a connection with another computer (IP address, name, IP
name)? Also, could you tell me how to find it on a computer? Since I'll
be testing the instant messenger on the three computers in my house, I
just need to know how to find the information on the computer I'd
currently be on (not from any remote location). Thanks! :)</div></blockquote><div><br>
<br>
You need to know the hostname of the remote machine you are trying to
make a connection to. From this you can work out the
IP address of the machine and then connect to it
directly. You could work with just the IP address,
but these are liable to change, where as the hostname in theory won't.<br>
<br>
>>> import socket<br>
>>> socket.gethostbyname('<a href="http://www.yahoo.com">www.yahoo.com</a>')<br>
'<a href="http://216.109.117.207">216.109.117.207</a>'<br>
>>> <br>
<br>
If the machine is on your network, using its name (eg 'JohnW' ) should give the same result<br>
<br>
HTH :)<br>
<br>
</div><br></div>