source: trunk/third/perl/eg/client @ 10724

Revision 10724, 602 bytes checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10723, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!./perl
2
3$pat = 'S n C4 x8';
4$inet = 2;
5$echo = 7;
6$smtp = 25;
7$nntp = 119;
8$test = 2345;
9
10$SIG{'INT'} = 'dokill';
11
12$this = pack($pat,$inet,0,   128,149,13,43);
13$that = pack($pat,$inet,$test,127,0,0,1);
14
15if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
16if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
17if (connect(S,$that)) { print "connect ok\n"; } else { die $!; }
18
19select(S); $| = 1; select(stdout);
20
21if ($child = fork) {
22    while (<STDIN>) {
23        print S;
24    }
25    sleep 3;
26    do dokill();
27}
28else {
29    while (<S>) {
30        print;
31    }
32}
33
34sub dokill { kill 9,$child if $child; }
Note: See TracBrowser for help on using the repository browser.