Article View: borland.public.jbuilder.java.language
Article #16732SocketException -- Help Needed !!!
From: Terrence Coccoli
Date: Mon, 25 Jan 1999 00:00
Date: Mon, 25 Jan 1999 00:00
32 lines
1364 bytes
1364 bytes
I'm getting a SocketException when I attempt to create a socket. All I'm
doing is trying to connect to any stupid host at socket 1024. I'm running a
W95 client. Here's the code. Please !!!! I need help.
package Internet;
import java.net.*;
import java.io.*;
public class PortChecker {
public static void main(String[] args) {
Socket sock;
InetAddress ia;
String host = args[0];
try {
ia = InetAddress.getByName(host);
try {
sock = new Socket(ia, 1024);
System.out.println("Server on port " + 1024 + " on host " + host);
}
catch (IOException ioe) {
System.err.println(ioe);
System.err.println(ioe.getMessage());
ioe.printStackTrace();
}
}//outer try loop
catch (UnknownHostException uhe) {
System.err.println(uhe);
}
}//main
}//class
Technical Details
Message-ID:
<78j4pb$rdg7@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,165d8ccd4ca0739,start X-Google-Attributes: gidf74b3,public From: "Terrence Coccoli" <tscoccol@worldnet.att.net> Subject: SocketException -- Help Needed !!! Date: 1999/01/25 Message-ID: <78j4pb$rdg7@forums.borland.com> X-Deja-AN: 436914655 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language