Oppure

Loading
13/07/09 9:54
riseofapocalypse
Non capisco una cosa...perchè la Microsoft ha messo Int32 al posto di UInt32? Intanto il numero dei Bytes può essere negativo! :rotfl:
aaa
13/07/09 9:55
GoLDBeRG
infatti si avrebbero portato il limite a 4 gb....
aaa
13/07/09 9:59
riseofapocalypse
Mah, misteri! :rotfl: comunque nessuno sa spiegarmi perchè request.ContentLength mi ritorna sempre -1? :-|
aaa
13/07/09 10:01
GoLDBeRG
succede pure a me... per prenderlo devi fare cosi...

       Dim wc As New WebClient
        Dim b1() As Byte = wc.Encoding.GetBytes("Get http://www.artfiles.org/knoppix/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso HTTP/1.1" & vbNewLine & vbNewLine)
        wc.OpenWrite("http://www.artfiles.org/").Write(b1, 0, b1.Length)
        wc.OpenRead("http://www.artfiles.org/knoppix/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso")
        For Each asd As String In wc.ResponseHeaders
            If IsNumeric(wc.ResponseHeaders.Item(asd)) Then
                filegen = wc.ResponseHeaders.Item(asd)
            End If
        Next


apoparte questo...

Imports System
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text

Public Class conn

    Public parte As Int32
    Public ferma As Int32
    Public start As Int32
    Public url As Uri

    Public Sub scarica()
        Try
            Dim request As HttpWebRequest = WebRequest.Create(url)
            request.AddRange(start, ferma)
            Dim response As HttpWebResponse = request.GetResponse
            Dim stream As Stream = response.GetResponseStream
            MsgBox("")
        Catch ex As Exception

        End Try
       
    End Sub
End Class


ho sbagliato qualcosa?? si blocca sul getresponse..... ho provato con google.it e va.... ma con i file no..... provi tu con qualcosaltro?
aaa
13/07/09 10:10
riseofapocalypse
Sinceramente non vedo errori! Comunque ho scoperto perchè ritorna -1, faccio sempre lo stesso errore! Cerco di ottenere l'header di richiesta ContentLength, invece devo prendere quello di risposta!
request.GetResponse.ContentLength
aaa
13/07/09 10:17
GoLDBeRG
manco io vedo errori pero' non funziona...solo con i file in remoto nn va con i siti in generale si...
aaa
13/07/09 10:19
riseofapocalypse
A me sinceramente funziona! :-| prova ad aspettare un po', magari si genera un'eccezione in ritardo...
aaa
13/07/09 11:04
GoLDBeRG
in locale va che strano.... cmq ci siamo vicini... molto vicini... guarda qui

Imports System
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text

Public Class conn

    Public ferma As Int32
    Public start As Int32
    Public url As Uri

    Public Sub scarica()
        Try
            Dim request As HttpWebRequest = WebRequest.Create(url)
            request.AddRange(start, ferma)
            Dim response As HttpWebResponse = request.GetResponse
            Dim stream As Stream = response.GetResponseStream
            While (True)
                Dim by(8192) As Byte
                Dim int As Integer = stream.Read(by, 0, by.Length)
                Thread.Sleep(10)
            End While
        Catch ex As Exception

        End Try
    End Sub
End Class
aaa