473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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
0 886

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DOK | last post by:
I'm trying to create an eBay ad. So far, I've got the page the way I want it. However, the few animated gif's I have on the page display but are no longer animated. I can get it to work in...
3
by: MarcJessome | last post by:
Hi, I was wondering if someone could help me through learning C++. I've tried learning before, but I find I would work better if I had someone that could help explain a few things to me. Im using...
6
by: Helmut Giese | last post by:
Hello out there, I am a rather experienced C programmer. However, today I got a javascript assignment because someone left (something like: "You're a great programmer - you'll handle this.") and I...
7
by: rn5a | last post by:
This is the second time I am asking this question in this newsgroup since I haven't got a solution or response from anyone in my previous post & I need to resolve this issue desperately. Sorry for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.