I just started socket programming in java.I read a few tutorial and came up with the following script
import java.net.*;
public class socket {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
String sentence;String modifiedSentenc e;
Socket clientSocket = new Socket("hostnam e", 8123);
System.out.prin tln(clientSocke t.getPort());
}
}
Now,when I run the codes i get the following exceptiions
Exception in thread "main" java.net.Unknow nHostException: hostname
at java.net.PlainS ocketImpl.conne ct(Unknown Source)
at java.net.SocksS ocketImpl.conne ct(Unknown Source)
at java.net.Socket .connect(Unknow n Source)
at java.net.Socket .connect(Unknow n Source)
at java.net.Socket .<init>(Unknow n Source)
at java.net.Socket .<init>(Unknow n Source)
at socket.main(soc ket.java:15)
I hava no idea what it is exactly and the pproblem with the codes here..I will be really obliged to those who can enlighten me a bit
Thanks in adv ...
import java.net.*;
public class socket {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
String sentence;String modifiedSentenc e;
Socket clientSocket = new Socket("hostnam e", 8123);
System.out.prin tln(clientSocke t.getPort());
}
}
Now,when I run the codes i get the following exceptiions
Exception in thread "main" java.net.Unknow nHostException: hostname
at java.net.PlainS ocketImpl.conne ct(Unknown Source)
at java.net.SocksS ocketImpl.conne ct(Unknown Source)
at java.net.Socket .connect(Unknow n Source)
at java.net.Socket .connect(Unknow n Source)
at java.net.Socket .<init>(Unknow n Source)
at java.net.Socket .<init>(Unknow n Source)
at socket.main(soc ket.java:15)
I hava no idea what it is exactly and the pproblem with the codes here..I will be really obliged to those who can enlighten me a bit
Thanks in adv ...
Comment