#include <rude/socket.h> #ifdef WIN32 #include <windows.h> #include <winsock2.h> #endif using namespace std; int main(void) { #ifdef WIN32 WSADATA wsadata; WSAStartup(MAKEWORD(2,2), &wsadata); #endif rude::Socket socket; if(socket.connectSSL("secure.ases.org", 443)) { if(!socket.sends("GET / HTTP/1.0\n")) { cerr << "Could not send: " << socket.getError() << "\n"; return 1; } if(!socket.sends("Host: secure.ases.org\n\n")) { cerr << "Could not send: " << socket.getError() << "\n"; return 1; } cout << socket.reads(); } else { cerr << "Could not connect: " << socket.getError() << "\n"; return 1; } socket.close(); #ifdef WIN32 WSACleanup(); #endif return 0; }Compile on linux with:
g++ -o test -lrudesocket test.cpp
Compile on Windows (bcc32) with:
bcc32 -DWIN32 test.cpp rudesocket.lib ssleay32.lib -libeay32.lib