title: c++ Poco libraries UDP DatagramSocket send example raise a Poco::Net::NetException
body: <p>I'm new to POCO lib and I'm doing the net examples on the tutorial pdf.</p>
  
  <p>When I'm running the DatagramSocket send example I'd always get a Poco::Net::NetException.</p>
  
  <p>If I use the port '514' given by the tutorial, I'll get a Poco::IOException "I/O Error".</p>
  
  <p>My environment is kubuntu 12.04, kernel 3.2.0-57-generic. Anyone knows about this?? Thx!!</p>
  
  <pre><code>// DatagramSocket send example
  #include &lt;Poco/Net/DatagramSocket.h&gt;
  #include &lt;Poco/Net/SocketAddress.h&gt;
  #include &lt;Poco/Timestamp.h&gt;
  #include &lt;Poco/DateTimeFormatter.h&gt;
  
  #include &lt;string&gt;
  
  int main()
  {
      Poco::Net::SocketAddress sa(Poco::Net::IPAddress(), 12345);
      Poco::Net::DatagramSocket dgs(sa);
  
      std::string syslogMsg;
      Poco::Timestamp now;
      syslogMsg = Poco::DateTimeFormatter::format(now, "&lt;14&gt;%w %f %H:%M:%S Hello, World!");
  
      dgs.sendBytes(syslogMsg.data(), syslogMsg.size());
  
      return 0;
  }//main
  </code></pre>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <p>Thanks for Joachim Pileborg for suggestions on <code>displayText()</code> of exception. It shows this: "Net Exception: Destination address required"</p>
  
  <p>And I amended the code like this and it worked:</p>
  
  <pre><code>Poco::Net::SocketAddress recver("localhost", 1234);
  dgs.sendTo(syslogMsg.data(), syslogMsg.size(), recver);
  </code></pre>
  
  <p><strong>But if I want to use <code>sendBytes()</code>, is there a way to put in a default receiver's address??</strong></p>