title: NullPointerException in DatagramSocket
body: <p>I am creating a server chat program in java using DatagramSocket and datagramPacket
  im getting a java.lang.NullPointerException in client code to send data packet</p>
  
  <pre><code>try
  {
      InetAddress ia = InetAddress.getLocalHost();
      String s1 = new String(Uname + "-C-" + ia.getHostAddress());
      cdp = new DatagramPacket(s1.getBytes(), s1.length(), ia, 7080);
      csock.send(cdp);
      csock.setSoTimeout(5000);
      csock.receive(cdp);
      s1 = new String(cdp.getData(), 0, cdp.getLength());
      chat.append(s1);
  }
  catch(Exception e)
  {
      onlineuser.append("\n" + e);
  }
  </code></pre>
  
  <p>Can someone help me to clear this bug.
  Thanks in advance</p>