Page 2 of 2

Posted: 22 Mar 2009, 12:47
by mellinger
Gesanan,
If I want to read an integer form the socket the code would be like this??

Code:

Code: Select all

int i; 

receiving_udpsocket s( host.c_str() ); 
sockstream udpIn( s ); 
udpIn >> i; 
cout << "\nReceived int: " << i; 
Yes, this code should work for integers transmitted as ASCII strings, provided each of them is followed with white space (the last one as well).

Juergen