I am ttying to write a gzip file that I have ftped from a server to a file so that it can be unzipped. When I use the code below to write the file into a local file, there are no errors but I cannot uncompress the file with a seperate gzip application or using the gzip class I created inside my application.
Code:
SW = "ftp://192.168.17.16/"
dir = ""
Un = "truecallpcmd"
pw = "tcftp"
Dim strd AsString
Dim ftpd As FtpWebRequest = FtpWebRequest.Create(SW & dir & FN)
ftpd.Credentials = New NetworkCredential(Un, pw)
ftpd.Method = WebRequestMethods.Ftp.DownloadFile
ftpd.UseBinary = True
Dim srd AsNew StreamReader(ftpd.GetResponse().GetResponseStream())
Dim fs AsNew FileStream("c:\GZ\Mylogx.gz", FileMode.OpenOrCreate, FileAccess.Write)
Dim writer AsNew BinaryWriter(fs)
‘writer.BaseStream.Seek(0, SeekOrigin.End)
DoWhile srd.EndOfStream <> True
writer.Write(srd.Read)
Loop
writer.Flush()
writer.Close()