From: ts Date: 2003-05-08T01:09:31+09:00 Subject: Re: okay, please explain this (see source below) >>>>> "d" == daniel writes: d> -- with gets -- [...] d> -- with read -- You seems to make confusion between IO methods and Socket methods. #read and #gets are IO methods and they have the same semantic than for a File object, for example #gets try to read a line terminated by \n #read without argument try to read all the data pigeon% ri IO#read ---------------------------------------------------------------- IO#read ios.read( [anInteger] ) -> aString or nil ------------------------------------------------------------------------ Reads at most anInteger bytes from the I/O stream, or to the end of file if anInteger is omitted. Returns nil if called at end of file. f = File.new("testfile") f.read(16) #=> "This is line one" pigeon% pigeon% ri IO#gets ---------------------------------------------------------------- IO#gets ios.gets( aSepString=$/ ) -> aString or nil ------------------------------------------------------------------------ Reads the next ``line'' from the I/O stream; lines are separated by aSepString. A separator of nil reads the entire contents, and a zero-length separator reads the input a paragraph at a time (two successive newlines in the input separate paragraphs). The stream must be opened for reading or an IOerror will be raised. The line read in will be returned and also assigned to $_. Returns nil if called at end of file. File.new("testfile").gets #=> "This is line one\n" $_ #=> "This is line one\n" pigeon% The low level socket methods are #send and #recv Guy Decoux