Dear All ----- Original Message ----- From: "Luis Parravicini" <lparravi / gmail.com> To: "ruby-talk ML" <ruby-talk / ruby-lang.org> Sent: Wednesday, May 23, 2007 11:10 PM Subject: Re: ruby socket programming > On 5/23/07, monarailguy42 <Larry.Erickson / gmail.com> wrote: > > # ... do something with the socket > > t.write("select read_count from tag_id") > > answer = t.gets > > How the device knows the data you wrote is the complete query? > Shouldn't you send some mark (newline, ';' or something like that) to > let the device knows where the query ends? > I Tried with socket server script from and the client is : ---Start---- #!/usr/local/bin/ruby require 'socket' aa=0 loop do aa = aa+1 sock = TCPSocket.new('127.0.0.1', 20000) sendit = "We send #{aa}" sock.send(sendit,0) str = sock.recv(100) puts 'we received #{str}' sock.close sleep (1) end ---Stop---- Work fine for me But .. i think it'll be better if the device can act as client, and always send all data in comma delimeted , so the server (we , user) can just wait for data and parse received data easily. Just like what Barcode reader do with keyboard port Sincerely -bino-