#include #include #include #include #include #pragma comment( lib, "ws2_32.lib" ) #include "connect.hpp" int main( ) { std::string ip; std::cin >> ip; client::c_connect c( ip.c_str( ) ); if( !c.setup( ) ) return 1; if( !c.connect( ) ) return 2; const char* yes = "hello server"; char buf[ 255 ]; memcpy( buf, yes, strlen( yes ) ); c.send_msg( ( uint8_t* )( buf ), strlen( yes ) ); printf( "message sent\n" ); auto msg = c.get_msg( ); while( !msg.size( ) ) { Sleep( 1 ); } printf( "[message received]: " ); for( auto& it : msg ) printf( "%c", it ); printf( "\n" ); c.send_msg( ( uint8_t* )( buf ), strlen( yes ) ); c.~c_connect( ); system( "pause" ); return 0; }