Code example for SocketException

Methods: printStackTrace

0
 
		try { 
			mSocket = new DatagramSocket(mPort);
 
		} catch (SocketException e) {
			e.printStackTrace();
			return -2; 
		} 
		 
		try { 
			mSocket.setSoTimeout(10000);
 
		} catch (SocketException e) {
			e.printStackTrace();
			return -3; 
		} 
 
		return 0; 
	} 
 
	// set socket for sending (fails if closed)