zutil-cpp/net/test_client.cpp

24 lines
521 B
C++

#include <iostream>
#include <string>
#include "socket.h"
#include "socketexception.h"
using namespace std;
int main ( int argc, int argv[] ){
try{
Socket socket ( "localhost", 30000 );
std::string reply;
try{
socket << "Test message.";
socket >> reply;
}
catch ( SocketException& ) {}
cout << "We received this response from the server:\n\"" << reply << "\"\n";
}catch ( SocketException& e ){
cout << "Exception was caught:" << e.description() << "\n";
}
return 0;
}