Need PERL example sysread and syswrite
hi,
i am trying to write a small FTP server.
now after all the normal authentication here is what i want to do.
check whether the selected file is there or not?
if it is there start tranfering it in binary mode.
now there is one problem i have doing this.
the sysread function has the following arguments.
sysread(FILEHANDLE, $scalar, $LENGTH)
Attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE, using the system call read().
now the thing is that how do i know what length a file is. cause every file will have a different length so i have to know the length of the file before i transfer it.
so how do i know what length a file is. REMEMBER THE FILE HAS TO BE TRANSFERED IN BINARY that is the mode of the handle will be changed to binary using binmode function.
secondly can any one tell me that if i syswrite() a file to socket how can i read it back at the client end using sysread of syswrite.
plz explain with little code.
|