This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes java socket programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java socket programming" Watch "java socket programming" New topic
Author

java socket programming

nayomi gunawardena
Greenhorn

Joined: Sep 17, 2011
Posts: 6
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
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
Doesn't the "e.printStackTrace()" do that?


Ping & DNS - updated with new look and Ping home screen widget
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

It should, and otherwise there's still e.getClass().


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
nayomi gunawardena
Greenhorn

Joined: Sep 17, 2011
Posts: 6
ok thanks alot guyzz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java socket programming
 
Similar Threads
NotSerializableException with java.net.Socket
Please help me out for the socket connection
Help me out to solve the exception
Error in calling shutDownInput and shutDownOutput
Producer/Consumer Design impacts exception handling