Overview
Features
Download
Documentation
Community
Add-Ons & Services

DatagramSocket: Cannot Assign Requested Address

Please post support and help requests here.

DatagramSocket: Cannot Assign Requested Address

Postby lion87 » 07 Aug 2013, 14:01

Hi,
I want to open a Datagramsocket and send some packets to my network device.
However when i use the following cood an exception is thrown saying:
Code: Select all
Cannot Assign Requested Address: 192.168.1.114:1900

Code: Select all
Poco::Net::SocketAddress sa("192.168.1.114",1900);
Poco::Net::DatagramSocket dgs(sa);
std::string text = "hello";
dgs.sendBytes(text.data(),text.size());


I really don't know what's the problem here, because when i send a dummy udp packet with some udp software to this device, it works.
lion87
 
Posts: 3
Joined: 01 Aug 2013, 15:33

Re: DatagramSocket: Cannot Assign Requested Address

Postby cathyl » 16 Sep 2013, 19:34

I just ran into this same problem. In browsing the General Discussion forum, I found a post by someone with a correction to the Net lib introductory slides -- this sample DatagramSocket receive code doesn't work.
Code: Select all
Poco::Net::SocketAddress sa(Poco::Net::IPAddress(), 514);
Poco::Net::DatagramSocket dgs(sa);

The correction is to do this:

Code: Select all
Poco::Net::SocketAddress sa(Poco::Net::IPAddress(), 514);
Poco::Net::DatagramSocket dgs;
dgs.connect(sa);

Making this change to my code got rid of the "Cannot assign requested address" error.

Cheers,
-- Cathy
cathyl
 
Posts: 2
Joined: 09 Oct 2012, 21:28


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron