From: Rich Kilmer Date: 2002-08-19T02:50:42+09:00 Subject: RE: Flash socket server - can I make it any shorter?? This is very cool. The code you are looking for is TCPServer.open("0.0.0.0",4444) That listens on all devices. BTW: I just joined this project: http://freemovie.sourceforge.net to get the Ruby library up to the current PHP reference implementation. This will allow us to generate .swf files from a pure Ruby script. I think that flash/actionscript and ruby (as the backend) would ROCK. -rich > -----Original Message----- > From: Rich [mailto:rich@lithinos.com] > Sent: Friday, August 16, 2002 6:20 PM > To: ruby-talk ML > Subject: Flash socket server - can I make it any shorter?? > > Here's what I have - 91 characters with everything you'd need for a Flash > XMLSocket 'echo' server:: > > Not pretty version - > require > "socket";s=TCPServer.open("10.0.0.2",4444).accept;loop{;s.gets("\0");s.w ri > te > ($_);}; > > Pretty version - > require "socket" > s=TCPServer.open("10.0.0.2",4444).accept > loop{ > s.gets("\0") > s.write($_) > } > > > Looking at it now - maybe I could:: > > require "socket" > s=TCPServer.open("10.0.0.2",4444).accept > loop{ > s.gets("\0").write($_) > } > > > Then I thought I remembered reading somewhere about something like - > TCPServer.open(0) > > Where that code would listen on 'all devices'... if I'm making any > sense... > But then how could I specify the port?? > > Thanks for any help I can get! : ) > > -Rich > P.s. - Since I came from a Perl-ish background.. the 'short' perl version > was 300 characters.... >