From: Austin Ziegler Date: 2002-11-08T01:04:47+09:00 Subject: Re: A Question About TCPSocket On Thu, 7 Nov 2002 23:48:51 +0900, 嫖仞 wrote: >Hello, > I create an object of TCPSocket. Now I can use method "write" to >send a string. >What method that I can send a file using TCPSocket? > Sheen Zan > Well, in Ruby terms, a file is just a string -- once it's read in. Lyle Johnson pointed out that you can do this: ICON_FILE = 'icon.jpg' bytes = File.open(ICON_FILE, 'rb').read File.open('icon.rb', 'w') do |f| f.puts "ICON_STRING = #{bytes.inspect}" end There's no reason that you can't end up treating the TCPSocket the same way. -austin -- Austin Ziegler, austin@halostatue.ca on 2002.11.07 at 11.02.28