Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!uunet!zephyr.ens.tek.com!uw-beaver!ssc-vax!fluke!gtisqr!stu From: stu@gtisqr.uucp (Stu Donaldson) Newsgroups: comp.lang.perl Subject: read from socket fails (was Re: New version of nftp) Summary: Problem with 386/ix? Message-ID: <1990Jul21.220044.19364@gtisqr.uucp> Date: 21 Jul 90 22:00:44 GMT References: Distribution: comp Organization: Global Tech International Inc. Lines: 38 In article 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() { 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