Code example for DatagramSocket

Methods: close, setBroadcast

0
	private static class sendThread extends Thread {
    	public void run(){ 
    		//Looper.prepare(); 
    		try  
            { 
    			socket = new DatagramSocket(dgPort);
    			socket.setBroadcast(true);
    			Thread rThread = new Thread(new ReceiverThread(stream_screen));
    			rThread.start();
    			Thread p2pThread = new Thread(new P2PThread());
    			p2pThread.start();
    			return; 
    			 
    		} catch (IOException e) {
    			// TODO Auto-generated catch block 
    			socket.close();
    			Log.e(TAG, "Error in Datagram socket!");
    			e.printStackTrace();
    		} 
    		 
    		//Looper.loop();