1 |
ab11 |
1.1 |
// tdinread.cc. Test for -*- C++ -*- socket library |
2 |
|
|
// Copyright (C) 1992,1993,1994 Gnanasekaran Swaminathan <gs4t@virginia.edu> |
3 |
|
|
// |
4 |
|
|
// Permission is granted to use at your own risk and distribute this software |
5 |
|
|
// in source and binary forms provided the above copyright |
6 |
|
|
// notice and this paragraph are preserved on all copies. |
7 |
|
|
// This software is provided "as is" with no express or implied warranty. |
8 |
|
|
// |
9 |
|
|
// Version: 17Oct95 1.10 |
10 |
|
|
|
11 |
|
|
#include <sockinet.h> |
12 |
|
|
|
13 |
|
|
int main(int ac, char** av) |
14 |
|
|
{ |
15 |
|
|
isockinet isin (sockbuf::sock_dgram); |
16 |
|
|
|
17 |
|
|
isin->bind (); |
18 |
|
|
|
19 |
|
|
cout << "localhost = " << isin->localhost() << endl |
20 |
|
|
<< "localport = " << isin->localport() << endl; |
21 |
|
|
|
22 |
|
|
char buf[256]; |
23 |
|
|
int n; |
24 |
|
|
|
25 |
|
|
isin >> n; |
26 |
|
|
cout << av[0] << ": "; |
27 |
|
|
while(n--) { |
28 |
|
|
isin >> buf; |
29 |
|
|
cout << buf << ' '; |
30 |
|
|
} |
31 |
|
|
cout << endl; |
32 |
|
|
|
33 |
|
|
return 0; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
|