cpp utils files, network and a smal util class
This commit is contained in:
parent
ea3dffdb4a
commit
62f50a2f79
13 changed files with 610 additions and 0 deletions
24
net/test_client.cpp
Normal file
24
net/test_client.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue