log_client.pl
上传用户:wzkunzhan
上传日期:2022-04-23
资源大小:2618k
文件大小:1k
- # File: log_client.pl
- #
- # Modified OpenPhone based Voice Evaluation Tool (MOBVET) Version 0.1
- # --------------------------------------------------------------------
- # Voice Over IP Laboratory (http://www.voip.nce.ufrj.br)
- # Federal University of Rio de Janeiro
- # Copyright (c) 2002-2004 UFRJ (Federal University of Rio de Janeiro).
- # The contents of this file are subject to the Mozilla Public License
- # Version 1.0 (the "License"); you may not use this file except in
- # compliance with the License. You may obtain a copy of the License at
- # http://www.mozilla.org/MPL/
- #! c:/perl/bin/perl.exe -w
- use strict;
- use IO::Socket;
- my $line;
- my $ftp_server_host = $ARGV[0];
- foreach $line (`netstat -an`) # get the active connections
- {
- #TCP 146.164.247.200:2578 146.164.247.196:1721 ESTABLISHED
- if($line =~ /TCPs(.*):.*s(.*):172[1|0]/o ) # match the file server
-
- {
- print "Getting file log from $2n";
- $ftp_server_host = $2;
- }
- }
- my $host = $ftp_server_host;
- #my $port = shift || 5050;
- my $port = 5050;
- my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp');
- $sock or die "no socket :$!";
- my $buffer;
- my $file = "sideB.H323";
- open(FILE, ">$file") or die "could not open $file";
- while (defined ($buffer = <$sock>))
- {
- print FILE $buffer;
- }
-
- close $sock;
- close FILE;