[comp.lang.perl] read from socket fails

stu@gtisqr.uucp (Stu Donaldson) (07/22/90)

In article <YUKNGO.90Jul17180250@obelix.gaul.csd.uwo.ca> yukngo@obelix.gaul.csd.uwo.ca (Cheung Yukngo) writes:
>I have modified nftp, fixed a few bugs and generally improved the
>program. The code is ~20k. I don't think the interest is high enough
>to warrant a post here. If you are interested, please email me at
>clipper@csd.uwo.ca.

I received nftp this morning, and ran into a couple of problems getting
it to work on System V 386/ix.  The big problem is that the read
command within perl doesn't seem to work with sockets.  I was able
to open a connection to another host, and login without any problems.
However, when doing 'ls' no data would be displayed.  I changed the
loop where he was reading the directory in from the socket

	  while (read(DATA1, $buf, 1000) > 0) {
	    $buf =~ s/\r//g if ($NOCR);
	    print $buf;
	  }
 to read

	while(<DATA1>) {
		print $_; 
	}

 The later case worked fine.  The read, however, was not returning
 any information in $buf.  The read would return 0 bytes read.

 On completion, the server that I was connnected to would occasionally
 give an error '550 /bin/ls -l: No such device or address'.

 Again, this would only happen with the read.  The get file command
 also fails on the read call.  I have been able to send files, which
 does a read from the file, and print to the socket without problems.

Any ideas?  I'm new to perl, and may have missed something earlier.
-- 
Stu Donaldson          UUCP: {smart-host}!gtisqr!stu
Global Technology      ARPA: gtisqr!stu@yang.cpac.washington.edu
Mukilteo, Washington   Bell: (206) 742-9111