Re: Create InetAddress from a String.
- From: Ross Bamford <ross@xxxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 00:08:03 +0100
On Fri, 2005-04-29 at 17:53 +0000, jseidelREMOVECAPS@xxxxxxxxxxxx wrote:
> I need to create a socket connection to a site.
>
> String name = "elektra.usm.com"
> socket sock = new socket( name, port );
>
> This wont work because the name isn't an ip address. I need to create
> an InetAddress from it. How do I do that?
>
> Jerry
For example:
import java.net.InetAddress;
import java.net.UnknownHostException;
try {
InetAddress in = InetAddress.getByName("www.somewhere.com");
} catch (UnknownHostException e) {
// .. whatever
}
Ross
--
[Ross A. Bamford] [ross AT the.website.domain]
Roscopeco Open Tech ++ Open Source + Java + Apache + CMF
http://www.roscopec0.f9.co.uk/ + info@xxxxxxxxxxxxxxxxxx
.
- References:
- Create InetAddress from a String.
- From: jseidelREMOVECAPS
- Create InetAddress from a String.
- Prev by Date: Re: the right way to kill a java thread on Windows?
- Next by Date: Re: How to get the runtime class?
- Previous by thread: Re: Create InetAddress from a String.
- Next by thread: Re: Create InetAddress from a String.
- Index(es):
Relevant Pages
|
|