It's easier with a library that abstracts the complicated socket stuff.
Right now I would probably consider using boost for it (personally).
#include <boost/asio.hpp>
void TransferData( std::string data )
{
//Server/port.
boost::asio::ip::tcp::iostream con("server","9001");//or protocol, like "HTTP"
if( !con )
;//Connecting failed or something.
else
con << "Ehlo their mate. Have sum datums." << data << std::flush;
con.close();
}
You can find an installer for boost here: www.boostpro.com
Then in your project settings -> include directories,
add the main boost folder to the include directories
and the "lib" folder to the lib directories.
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111