Overview
Features
Download
Documentation
Community
Add-Ons & Services

DatagramSocket

Please post support and help requests here.
hlumca
Posts: 2
Joined: 06 Feb 2009, 00:01

DatagramSocket

Postby hlumca » 06 Feb 2009, 23:54

I am trying to use a DatagramSocket as follows:

Code: Select all

SocketAddress dest(HOST, PORT);
DatagramSocket sock();
sock.sendTo(msg, msg.length(), dest);


My compiler reports the following error:

error: request for member 'sendTo' in 'sock', which is of non-class type 'Poco::Net::DatagramSocket ()()'

What am I doing wrong?

guenter
Posts: 1180
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: DatagramSocket

Postby guenter » 07 Feb 2009, 00:16

Try this:

Code: Select all

SocketAddress dest(HOST, PORT);
DatagramSocket sock;
sock.sendTo(msg, msg.length(), dest);


In your code, you are declaring a function named sock returning a DatagramSocket. That's a frequent C++ gotcha...


Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests

cron