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

Can someone take a look at this and see if they can find the problem?

P: n/a
i'm working on a program that downloads from news groups.

it works fine on (UUE and MIME" encoded files but when you get to a
yenc encoded file it messes up. the lines are all diffrent lengths and
they can not be decoded.

it must be in the way i'm getting the info back from the server.

could someone take a look at the code or maybe tell me a better way to
get the info back from the server?

i have can not think of anything else to try..

thanks

Public Sub Connect(ByVal hostNameOrAddress As String, ByVal port As
Int32)

Dim serverAddress As IPAddress
Try
serverAddress =
Dns.Resolve(hostNameOrAddress).AddressList(0)
Catch ex As Exception
Throw New Exception("Could not resolve Host name or
Address.", ex)
Exit Sub
End Try

Try
_MySocket = New TcpClient(hostNameOrAddress, port)
Catch ex As Exception
_Connected = False

End Try

_MySocket.GetStream.BeginRead(_Mydata, 0, 1024, AddressOf
ReceiveCallback, Nothing)

End Sub

Private Sub ReceiveCallback(ByVal ar As IAsyncResult)
Dim intCount As Integer

Try
intCount = _MySocket.GetStream.EndRead(ar)
If intCount < 1 Then
'Me.IsConnected = False
Exit Sub
End If

BuildString(_Mydata, 0, intCount)

_MySocket.GetStream.BeginRead(_Mydata, 0, 1024, _
AddressOf ReceiveCallback, Nothing)
Catch e As Exception
'MarkAsDisconnected()
End Try
End Sub

Private Sub BuildString(ByVal Bytes() As Byte, _
ByVal offset As Integer, ByVal count As Integer)
Dim intIndex As Integer

For intIndex = offset To offset + count - 1
If Bytes(intIndex) = 10 Then
mobjText.Append(vbLf)

Dim params() As Object = {mobjText.ToString}
Dim s As String =
System.Text.ASCIIEncoding.ASCII.GetChars(Bytes)

For i As Integer = 0 To params.Length - 1
_TextB = s
GetNcode(params(i))
Next

mobjText = New StringBuilder
Else
mobjText.Append(Chr(Bytes(intIndex)))
End If
Next
End Sub

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.