NNTP Image reader

N

nondos

Hello

I coded vb.net 2005 application to d.l binary pictures file from news
network server and then decode the file with yEnc and show the pictures.

the code work fine, but the files i d.l from the newsgroups are corrupt most
of the time, it's possible to decode the files with yenc and most of the
picture is fine but there's some bugs on the picture.
I tested the files with commerical NNTP program and the files are fine.

First I tought maybe i lost data in the tcp ip transfer between me and the
newsgroups but then i noticed that the picture have the same bug everytime i
d.l it

That's mean i think i have problem with the encoding of the data i get from
the server and one char or maybe more ain't encoding well and it's courrpt
the file i'm using the "windows-1252"

any idea what can i do?

thanks

-----code-------
Private Sub ReadToFile(ByVal file As String)

Dim sw As New System.IO.StreamWriter(file, False,
System.Text.Encoding.GetEncoding("Windows-1255"))

Dim yEnc As New TextCodec.Yenc

Dim output As String = ""

streamReader = New System.IO.StreamReader(networkStream,
System.Text.Encoding.GetEncoding("Windows-1255"))

streamReader.ReadLine()

Do While streamReader.Peek > 0

System.Threading.Thread.Sleep(1)

If output <> "" Then output = output & vbCrLf

output = output & streamReader.ReadLine

Loop

yEnc.Decode(output, "c:\test\", 0)

sw.Write(output)

sw.Flush()

sw.Close()

End Sub
 
N

nondos

I've found the problem for anyone who have the same problem:

I did not realize that the NNTP-protocol requires to double a dot in the
first colum when a line is sent - and to detect a double dot (and remove one
of them) when receiving a line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top