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 |
} |