server-client-vip> topical media & game development
topical media & game development

talk show tell print

server-client-vip.c

? / server-client-vip.c


  include <hush/source.h>
  include <socket/socket.h>
  
  include <iostream>
  
  using namespace std;
  
  

main


  
  int main(int argc, char* argv[]) {
  
    try {
      SocketClient s("localhost", 9000);
  
      //s.SendLine("GET / HTTP/1.0");
      //s.SendLine("Host: www.google.com");
      //string x = (char*) argv[1];
      char* x = argv[1];
  
      char* p = x;
      while (*p && p) { 
         if (*p == ' '|| (*p == '\n')) *p = ':';
         p++;
         }
      cout << (char*) x << endl;
  
      //s.SendLine(argv[1]);
      s.SendLine((char*)x);
  
      while (0) {
        string l = s.ReceiveLine();
        if (l.empty()) break;
        cout << l;
        cout.flush();
      }
  
    } 
    catch (const char* s) {
      cerr << s << endl;
    } 
    catch (std::string s) {
      cerr << s << endl;
    } 
    catch (...) {
      cerr << "unhandled exception\n";
    }
  
    return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.