ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/test/twhois.C
Revision: 1.1
Committed: Mon Feb 26 15:02:39 2001 UTC (24 years, 10 months ago) by ab11
Content type: text/plain
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Log Message:
Test programs for Networking class. Unused by the host

File Contents

# Content
1 #include <sockinet.h>
2
3 int main(int ac, char** av)
4 {
5 if (ac != 2 && ac != 3) {
6 cerr << "USAGE: " << av[0] << " [ -l ] user_name\n";
7 return 1;
8 }
9
10 iosockinet sio (sockbuf::sock_stream);
11
12 if (ac == 3) {
13 if (av[1][0] != '-' || av[1][1] != 'l') {
14 cerr << "USAGE: " << av[0] << " [ -l ] user_name\n";
15 return 1;
16 }
17 // use local whois server
18 sio->connect ("128.143.2.20", "whois", "tcp");
19 sio << av[2] << "\r\n" << flush;
20 } else {
21 sio->connect ("nic.ddn.mil", "whois", "tcp");
22 sio << av[1] << "\r\n" << flush;
23 }
24
25 char buf[1024];
26 while ( sio.getline(buf, 1023) ) cout << buf << endl;
27 cout << endl;
28
29 return 0;
30 }