ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/test/tcecho.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 <echo.h>
2 #include <stdlib.h>
3
4 int main (int ac, char** av)
5 {
6 if (ac < 3) {
7 cerr << "USAGE: " << av [0] << " remote-host portno string...\n";
8 return 1;
9 }
10
11 int portno = atoi (av [2]);
12
13 echo e(protocol::tcp);
14
15 if (portno == 0)
16 e->connect (av [1]);
17 else
18 e->connect (av [1], portno);
19
20 cout << e->rfc_name () << ' ' << e->rfc_doc () << endl;
21
22 for (int i = 0; i < ac; i++) {
23 char buf [256];
24
25 cout << "sending: " << av [i] << endl;
26
27 e << av [i] << endl;
28
29 e.getline (buf, 255);
30
31 cout << "got back: " << buf << endl;
32 }
33
34 return 0;
35 }