From: Gyoung-Yoon Noh Date: 2006-04-13T18:55:25+09:00 Subject: Re: TCPsocket send, puts and write On 4/13/06, brad tilley wrote:> What are the differences (if any) between these methods of sending data:>> t = TCPsocket.new(host, port)> t.write(a_string)> t.close>> t = TCPsocket.new(host, port)> t.puts(a_string)> t.close>> t = TCPsocket.new(host, port)> t.send(a_string)> t.close>> --> Posted via http://www.ruby-forum.com/.>> Hi, $ irbirb(main):001:0> require 'socket'=> trueirb(main):002:0> ts = TCPSocket.new('0', 80)=> #irb(main):003:0> m1 = ts.method(:send)=> #irb(main):004:0> m2 = ts.method(:write)=> #irb(main):005:0> m3 = ts.method(:puts)=> # TCPSocket#send and TCPSocket#write are functionally same.But TCPSocket#puts appends "\n" to the output string. HTH, --http://nohmad.sub-port.net