+2  A: 

If I not mistake, you are trying to use UNICODE string -- tchar. Use standard

int main(int argc,char **argv)
Artyom
+3  A: 

You would run the program with the IP or Hostname of the server you want to connect to. tcp::resolver::query takes the host to resolve or the IP as the first parameter and the name of the service (as defined e.g. in /etc/services on Unix hosts) - you can also use a numeric service identifier (aka port number). It returns a list of possible endpoints, as there might be several entries for a single host.

VolkA
tcp::resolver::query query("localhost", "daytime"); //it works//I wanted to test the example on localhost
chester89