ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/test/tdinwrite.C
Revision: 1.2
Committed: Mon Jun 10 14:10:44 2002 UTC (22 years, 4 months ago) by tdb
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Tidy up of files. These are all old things that are not only no longer used
but are also probably useless to anyone other than us. This saves checking
them out all the time, and makes the "cms/source" tree contain only current
stuff. They'll still exist in the attic's though :)

File Contents

# Content
1 // tdinwrite.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 #include <stdlib.h>
13 #include <unistd.h>
14
15 int main(int ac, char** av)
16 {
17 if (ac < 3) {
18 cerr << "USAGE: " << av[0] << " thostname port-number "
19 << "data ... " << endl;
20 return 1;
21 }
22
23 osockinet osin (sockbuf::sock_dgram);
24
25 osin->connect (av[1], atoi (av[2]));
26
27 cout << "local: " << osin->localport() << ' ' << osin->localhost() << endl
28 << "peer: " << osin->peerport() << ' ' << osin->peerhost() << endl;
29
30 // test socket options
31 cout << "socket type = " << osin->gettype() << endl;
32 cout << "socket linger time = " << osin->linger(10) << endl;
33 cout << "socket linger time = " << osin->linger(0) << endl;
34 cout << "socket linger time = " << osin->linger() << endl;
35 // cout << "socket send bufsz = " << osin->sendbufsz() << endl;
36 // cout << "socket recv bufsz = " << osin->recvbufsz() << endl;
37 cout << "socket keepalive = " << osin->keepalive(1) << endl;
38 cout << "socket keepalive = " << osin->keepalive(0) << endl;
39 cout << "socket clearerror = " << osin->clearerror() << endl;
40 cout << "socket debug = " << osin->debug(1) << endl;
41 cout << "socket debug = " << osin->debug(0) << endl;
42 cout << "socket reuse = " << osin->reuseaddr(1) << endl;
43 cout << "socket reuse = " << osin->reuseaddr(0) << endl;
44
45 #ifdef __linux__
46 int timeo = 0;
47 osin->getopt(sockbuf::so_sndtimeo, &timeo, sizeof(timeo));
48 cout << "socket sendtimeo = " << timeo << endl;
49 osin->getopt(sockbuf::so_rcvtimeo, &timeo, sizeof(timeo));
50 cout << "socket recvtimeo = " << timeo << endl;
51 #endif
52
53 osin << ac-3; av += 3;
54 while(*av) osin << *av++ << ' ';
55 osin << endl;
56
57 return 0;
58 }
59
60
61