2013-10-09 37 views
1

我想從Ubuntu上運行的apache2.2通過LAN網絡發送http文件傳輸(視頻文件)。
客戶端在提供文件後變爲無響應。 apache2日誌說明了獲取請求的響應代碼200。 當我查看wireshark報告時,我看到很多'持續或非http流量'。 不知道爲什麼我得到這個錯誤,有沒有什麼辦法可以安排數據包或需要在網絡層配置? (代理等..)? 以下是服務器代碼:延續或非HTTP流量錯誤

#!/usr/bin/perl 
use strict; 
use warnings; 
use CGI; 
use CGI::Carp qw(fatalsToBrowser); 
use File::Copy qw(copy); 
use File::Spec::Functions qw(catfile); 
use POSIX qw(strftime); 
use Time::Local; 
use HTTP::Status qw(:constants :is status_message); 
use Digest::MD5 qw(md5 md5_hex md5_base64); 
use File::Basename; 
#use File::Slurp; 
use URI; 
use utf8; 


my $extfile = '/home/suresh/clientrequest.txt'; 
open(FH, ">>$extfile") or die "Cannot open file"; 
my $query = CGI->new; 
my $stcode = status_message(206); 
my $uri =$ENV{'REQUEST_URI'}; 
my $rdate =strftime("%a, %d %b %Y %H:%M:%S %Z", localtime()); 
print FH "Client request: ", $ENV{'REQUEST_URI'}, "\n"; 
my $dir = '/srv/samba/Assets'; 
my $nffFile = fileparse ("$uri", qr/\.[^.]*/); 
my $fullFname = $nffFile . ".nff"; 
my $path = catfile($dir, $fullFname); 
my $filesize = -s $path; 
print FH "Size of the file: ", $filesize, "\n"; 
print FH "Requested File: ", $fullFname, "\n"; 
#Search requested asset files 
opendir(DIR, $dir); 
my @files = readdir(DIR); 
if (grep($_=~/$fullFname/,@files)){ 
    print FH "Found the requested NFF file: ", $fullFname, "\n"; 

# open my $fh, '<:raw', $path; 
open (FILE, "< $path") or die "cannot open $fullFname\n"; 

print "$ENV{SERVER_PROTOCOL} 206 $stcode"; 
print("Content Type: application/octet-stream\n\n"); 


while (<FILE>) { 

     print; 
} 
sleep(1); 
close FILE or die "Cannot close the file"; 

} 
+0

你爲什麼要發送206響應(「部分內容」),然後發送整個文件(沒有任何206的必需標題)? – AKHolland

+0

我想要一個簡單的標準http文件傳輸。來自客戶端的請求標題表示字節範圍爲188,所以我只添加了206作爲標題。我用200嘗試,但我得到同樣的錯誤。 – Suresh

回答

0

解決了此問題。問題在於realtek驅動程序r8169被破壞,導致內核和接口丟包。我安裝8168這是最新的驅動程序,它解決了問題。