// Simple example showing the use of the client library. include <hush/session.h> include <hush/kit.h> include <hush/client/client.h> include <hush/client/MIME.h> include <hush/client/url.h> include <iostream.h> ostream& operator<<(ostream& os, url& x) { os << x.protocol() << " " << x.host() << " " << x.locator() << " " << x.port() ; }
class application: public session { public: application(int argc, char* argv[], char* name): session(argc, argv, 0) {} int main() { url* x; x = new url("http://www.cs.vu.nl/~eliens"); cerr << *x << endl; x = new url("tcp://localhost:3010/whatis"); cerr << *x << endl; x = new url("corba://hush:3010/clock"); cerr << *x << endl; x = new url("hush:3010/clock"); cerr << *x << endl; x = new url("clock"); cerr << *x << endl; char* Buffer; int Length; client net; net.get("example.txt"); net.send_request(); net.get_reply_body(Buffer, Length); cout << "The file is:" << endl; cout << Buffer; cout << "The length is: " << Length << endl; MIME* m = net.media(); cout << "The MIME type is: "; if (m) cout << m->type() << "/" << m->subtype() << endl; tk->quit(); return OK; } };
int main(int argc, char* argv[]) { application App(argc, argv, 0); return App.run(); }
Hush Online Technology
hush@cs.vu.nl
09/09/98 |
![]() |
![]() |