P
pbd22
Hi.
I have recently been working with FTP using microsofts clsFTP class.
I have been attempting to alter the clsFTP.Upload method to get the
number of bytes as
they are being sent in addition to sending the actual file.
to do this, i have added the following property:
Public Property ByteCount() As Int32
Get
Return m_iBytesTotal
End Get
Set(ByVal value As Int32)
m_iBytesTotal = value
End Set
End Property
and i have changed the upload Sub to a Function in addition to adding
the below 2 lines
(between "?" lines) to the function:
[SNIP....]
input = New FileStream(sFileName, FileMode.Open)
' Upload the file
m_iBytes = input.Read(m_aBuffer, 0, m_aBuffer.Length)
Do While (m_iBytes > 0)
cSocket.Send(m_aBuffer, m_iBytes, 0)
m_iBytes = input.Read(m_aBuffer, 0,
m_aBuffer.Length)
'??????????????????????????????????????????????????????????????????????????????
m_iBytesTotal += m_iBytes
Return ByteCount = m_iBytesTotal
'??????????????????????????????????????????????????????????????????????????????
Loop
input.Close()
[SNIP...]
This works great. I can get the bytes in progress once the upload is
started. The problem
is that the "actual upload" doesnt happen. Is it possible that the fact
that i have changed
this code from a Sub to a Function (in addition to adding a return
statement inside the while
loop) is causing this problem? When I remove the 2 lines and change
this Function back to
a Sub the upload goes without a hitch.
i hope i have explained myself clearly.
thanks in advance.
I have recently been working with FTP using microsofts clsFTP class.
I have been attempting to alter the clsFTP.Upload method to get the
number of bytes as
they are being sent in addition to sending the actual file.
to do this, i have added the following property:
Public Property ByteCount() As Int32
Get
Return m_iBytesTotal
End Get
Set(ByVal value As Int32)
m_iBytesTotal = value
End Set
End Property
and i have changed the upload Sub to a Function in addition to adding
the below 2 lines
(between "?" lines) to the function:
[SNIP....]
input = New FileStream(sFileName, FileMode.Open)
' Upload the file
m_iBytes = input.Read(m_aBuffer, 0, m_aBuffer.Length)
Do While (m_iBytes > 0)
cSocket.Send(m_aBuffer, m_iBytes, 0)
m_iBytes = input.Read(m_aBuffer, 0,
m_aBuffer.Length)
'??????????????????????????????????????????????????????????????????????????????
m_iBytesTotal += m_iBytes
Return ByteCount = m_iBytesTotal
'??????????????????????????????????????????????????????????????????????????????
Loop
input.Close()
[SNIP...]
This works great. I can get the bytes in progress once the upload is
started. The problem
is that the "actual upload" doesnt happen. Is it possible that the fact
that i have changed
this code from a Sub to a Function (in addition to adding a return
statement inside the while
loop) is causing this problem? When I remove the 2 lines and change
this Function back to
a Sub the upload goes without a hitch.
i hope i have explained myself clearly.
thanks in advance.