Gestione ocx inet di vb6 per ftp

mercoledì 08 ottobre 2003 - 18.50

trinity Profilo | Guru

Ragazzi,
sto utilizzando il controllo ocx inet per creare un ftp, fino ad ora tutto ok, ma non riesco a determinare quanti byte di trasferimento in upload o download ho fatto.
Tenete presente che devo solo inviare un file alla volta è un txt che la sua grandezza può variare.

Mi potete far vedere un esempio di come determinare quanti byte uplodo durante il trasferimento.

Ciao e grazie

Brainkiller Profilo | Guru

Ciao Trinity,
quell'oggetto l'ho usato molto poco e l'ho abbandonato perchè faceva fare poche cose ed erano quelle cioè non potevano essere modificate a piacimento.
Per queste cose puoi usare VC++ oppure .NET.

Scusa, ma sbaglio o hai scritto che vuoi creare un FTP, sarebbe a dire ?

Ah, trinity, non è che per ogni post si può crare al volo uno snippet di codice ad-hoc, te l'ho già detto, sei tu il programmatore :P se no a fine mese ti mando a casa la fattura. Se si tratta di roba semplice e alla portata quotidiana si può fare ma non sempre. Se assieme a VS 6.0 ti sei installato anche l'MSDN molto codice c'è già lì.

Ciao
David

astambara Profilo | Newbie

Private Sub invia

var nome_file_ftp as string

nome_file_ftp = App.Path + "\file.txt"

Inet1.Execute "ftp://login:pwd@domain.it", "SEND " + nome_file_ftp + " /directory_destinataria/file.txt"

While Inet1.StillExecuting
DoEvents
Wend

end sub



Private Sub Inet1_StateChanged(ByVal State As Integer)

Select Case State

Case icNone

txtStato.Text = "none"

Case icResolvingHost

txtStato.Text = "Resolving Host"

Case icHostResolved

txtStato.Text = "Host Resolved"

Case icConnecting

txtStato.Text = "Connecting..."

Case icConnected

txtStato.Text = "Connected!"

Case icRequesting

txtStato.Text = "Requesting..."

Case icRequestSent

txtStato.Text = "Request Sent"

Case icReceivingResponse

txtStato.Text = "Receiving Response..."


Case icResponseReceived

txtStato.Text = "Response Received!"

Case icDisconnecting

txtStato.Text = "Disconnecting..."
status_ftp = 1

'segnalare l'errore

Case icDisconnected

txtStato.Text = "Disconnected"
status_ftp = 2

'segnalare l'errore

Case icError
' In case of error, return ResponseCode and
' ResponseInfo.
vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo
txtStato.Text = Err.Description
status_ftp = 3

'segnalare l'errore

Case icResponseCompleted ' 12

' Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents

*******************************************************************
********* per ogni ciclo sai che stai uploadando 1024 byte *****************
*******************************************************************

Do While Not bDone
strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents

If Len(vtData) = 0 Then
bDone = True
End If
Loop

status_ftp = 4

'FTP andato a buon fine

End Select

DoEvents

End Sub
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5