Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java socket programming

 
nayomi gunawardena
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.net.Socket;

public class MyClient {
public static void main(String[] args) {
try {
Socket socket = new Socket("127.0.0.1", 20000);
} catch(Exception e) {

System.out.println(e.getMessage());
e.printStackTrace();
}
}
}

how to see what exception is thrown in the above code snippet??
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't the "e.printStackTrace()" do that?
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should, and otherwise there's still e.getClass().
 
nayomi gunawardena
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks alot guyzz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic