By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,995 Members | 1,090 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,995 IT Pros & Developers. It's quick & easy.

NNTP Image reader

P: n/a
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

Jun 11 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

"nondos" <no****@nondos.orgwrote in message
news:Jc*********************@giganews.com...
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
Jun 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.