Code example for SocketException

Methods: printStackTrace

0
			socket = new DatagramSocket(new InetSocketAddress(
					InetAddress.getLocalHost(), localPort));
			 
 
		} catch (SocketException e) {
			e.printStackTrace();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
 
		byte[] buf = "hello".getBytes();
		DatagramPacket data = new DatagramPacket(buf, buf.length,
				gameAddress);
		socket.send(data);
		System.out.println("waitning");
		DatagramPacket rcv = new DatagramPacket(new byte[1000], 1000);
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE