English 中文(简体)
关于Sending Greatr files Over Duncan s TCPServer的问题
原标题:Problems With Sending Larger Files Over Ruby s TCPServer

我先建立了一个简单、单一服务服务器,该服务器用小型测试文档进行刚好的操作,但当我尝试掌握更多、更实际的档案时,情况就错了。

发放了5.2种甲基溴文档。 发放30.33份甲基溴文档,但需要很长时间(Like 15分钟左右)。 在发送38.5份甲基溴文档时,该服务器接收了该文档,但随后投下了错误:msconvert_server.rb:20:in written : Invalid front - 177raw (Errno:EINVAL)(179.raw being the name of the file)。

我对发生这种情况的原因感到悲痛。 。 这个论坛“似乎有答案,虽然它的确加快了发送和接收时间,也进入了第20条线,但它在另一个时候失败了。 我并不认为,TCP具有任何档案规模的限制,这促使我相信问题在于《鲁比法典》。 是否有任何人看到这一问题,或对可能在此发生的事情有想法?

这部法典。

<>Server:

require  socket 

server = TCPServer.open(2000)
loop {
  client = server.accept

  filename = client.gets.chomp

  puts "Reading contents of #{filename}.raw"
  raw_data = client.gets("


").chomp("


")

  (Line 20, where error occurs) File.open(filename + ".raw",  wb ) {|out| out.print raw_data}

  puts "Converting #{filename}"

  #It s lame to have a script run a script, but it s the only way to get this to work.
  system "scriptit.bat " + filename + ".raw"

  puts "Sending contents of #{filename}.mzML"
  client.print IO.read(filename + ".mzML")
  client.print "


"
  puts "Done"
  client.close
}

http://www.ohchr.org。

    host = config_value("//Host/@ip")
    port = 2000

    client = TCPSocket.open(host, port)

    fileName = @file.split("/")[-1].chomp(File.extname(@file))

    puts "Sending raw file"
    client.puts fileName
    client.print(File.open("#{@file}", "rb") {|io| io.read})
    client.print("


")  #This is the delimiter for the server

    puts "Receiving mzML file"
    File.open("#{$path}../data/spectra/#{fileName}.mzML",  wb ) {|io| io.print client.gets("


")}
    client.close
最佳回答

我找到了解决这一问题的办法。 https://stackoverflow.com/questions/3313235/ Increasing-the-loading-speed-of-large-files” 此前的问题,我修改了该守则:

Server: require socket

server = TCPServer.open(2000)
loop {
  client = server.accept

  filename = client.gets.chomp

  puts "Reading contents of #{filename}.raw"
  raw_data = client.gets("


").chomp("


")
  file = File.open(filename + ".raw",  wb )
  file.print raw_data
  file.close

  puts "Converting #{filename}"
  #It s lame to have a script run a script, but it s the only way to get this to work.
  system "scriptit.bat " + filename + ".raw"

  puts "Sending contents of #{filename}.mzML"
  data = IO.read(filename + ".mzML")
  client.print data
  client.print "


"

  puts "Done"
  client.close
}

http://www.ohchr.org。

host = config_value("//Host/@ip")
port = 2000

client = TCPSocket.open(host, port)

fileName = @file.split("/")[-1].chomp(File.extname(@file))

puts "Sending raw file"
client.puts fileName
data = IO.read("#{@file}")
client.print data
client.print "


"  #This is the delimiter for the server

puts "Receiving mzML file"
file = File.open("#{$path}../data/spectra/#{fileName}.mzML",  wb )
data = client.gets("


")
file.print data

client.close

看来,扩大国际交易日志一线人员解决了我大部分的大案鲁比问题。

问题回答

暂无回答




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签