J
jimgardener
hi
i am trying out connections using SocketChannel with different ports
on my machine.
I wrote the application as below
public class SChannel{
public static void main(String args[]){
try{
int port=Integer.parseInt(args[0]);
System.out.println("connecting to:"+port);
SocketChannel sc=SocketChannel.open();
InetSocketAddress isa=new
InetSocketAddress(InetAddress.getLocalHost(),port);
sc.connect(isa);
System.out.println("connected:"+sc.isConnected());
}
catch(Exception e){
e.printStackTrace();
}
}
i tried diff ports as argument..like 8080,8086,4444,9090..but all
gives 'net.ConnectException :connection refused:connect'
Is there something wrong with the way i am trying to connect
can somebody help
jim
i am trying out connections using SocketChannel with different ports
on my machine.
I wrote the application as below
public class SChannel{
public static void main(String args[]){
try{
int port=Integer.parseInt(args[0]);
System.out.println("connecting to:"+port);
SocketChannel sc=SocketChannel.open();
InetSocketAddress isa=new
InetSocketAddress(InetAddress.getLocalHost(),port);
sc.connect(isa);
System.out.println("connected:"+sc.isConnected());
}
catch(Exception e){
e.printStackTrace();
}
}
i tried diff ports as argument..like 8080,8086,4444,9090..but all
gives 'net.ConnectException :connection refused:connect'
Is there something wrong with the way i am trying to connect
can somebody help
jim