Overview
Features
Download
Documentation
Community
Add-Ons & Services

DatagramSocket

Please post support and help requests here.

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?
hlumca
 
Posts: 2
Joined: 06 Feb 2009, 00:01

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...
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron