This repository was archived by the owner on Jul 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathResetServer.pl
More file actions
executable file
·73 lines (56 loc) · 1.41 KB
/
ResetServer.pl
File metadata and controls
executable file
·73 lines (56 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/local/bin/perl
# Copyright SRA International
#
# Distributed under the OSI-approved BSD 3-Clause License.
# See http://ncip.github.com/pathway-interaction-database/LICENSE.txt for details.
use strict;
use FileHandle;
use Socket;
use CGI;
BEGIN {
my @path_elems = split("/", $0);
pop @path_elems;
push @INC, join("/", @path_elems);
}
use Blocks;
######################################################################
sub CatchPipe {
print STDERR "Caught PIPE signal\n";
}
$SIG{PIPE} = \&CatchPipe;
######################################################################
my $query = new CGI;
my $host = $query->param("host");
my $port = $query->param("port");
my $proto = getprotobyname('tcp');
my $request = "ResetServer()";
my $fh = new FileHandle;
print "Content-type: text/plain\n\n";
if ($host eq "") {
print "host missing\n";
exit;
}
if ($port eq "") {
print "port missing\n";
exit;
}
if ($host !~ /\./) {
$host .= ".nci.nih.gov";
}
print "Reseting host = $host, port = $port\n";
my $iaddr = gethostbyname($host);
my $sin = sockaddr_in($port, $iaddr);
if( !socket($fh, PF_INET, SOCK_STREAM, $proto) ) {
print "Cannot open socket to $host:$port\n";
exit;
}
if( !connect($fh, $sin) ) {
print "Cannot connect to $host:$port, $!\n";
exit;
}
if( !SendBlocks($fh, \$request) ) {
print "SendBlocks failed for $host:$port\n";
exit;
}
close($fh);
print "done\n";