09/07/09 13:57
riseofapocalypse
Può darsi che non dipenda da tuoi errori! xD prova ad usare la mia classe Download:
Dimmi che velocità riesci a raggiungere
Class Download #Region "Events" Public Event DownloadStarted As EventHandler Public Event DownloadCompleted As EventHandler Public Event DownloadProgressChanged As EventHandler Public Event DownloadAborted As EventHandler Public Event DownloadPaused As EventHandler Public Event DownloadResumed As EventHandler #End Region #Region "Attributes" Private s, d As String Private b, sec, v As Decimal Dim t As Threading.Thread, ss As IO.BufferedStream, ds As IO.FileStream, dst As DownStatus Dim WithEvents tim As New Timer With {.Interval = 1000} #End Region #Region "Enums" Enum DownStatus NoOperation = 0 Downloading Paused Completed End Enum #End Region #Region "Constructors" Public Sub New(ByVal url As String, ByVal filename As String) s = url d = filename b = 0 sec = 0 t = Nothing ss = Nothing ds = Nothing dst = DownStatus.NoOperation End Sub #End Region #Region "Properties" Public Property Source() As String Get Return s End Get Set(ByVal value As String) s = value End Set End Property Public Property Destination() As String Get Return d End Get Set(ByVal value As String) d = value End Set End Property Public ReadOnly Property DownloadedBytes() As Decimal Get Return b End Get End Property Public ReadOnly Property Seconds() As Decimal Get Return sec End Get End Property Public ReadOnly Property Speed() As Decimal Get Return v End Get End Property Public ReadOnly Property DownloadStatus() As DownStatus Get Return dst End Get End Property #End Region #Region "Public methods" Public Sub StartDownload() t = New Threading.Thread(AddressOf Download) ss = New IO.BufferedStream(Net.WebRequest.Create(s).GetResponse.GetResponseStream) ds = New IO.FileStream(d, IO.FileMode.OpenOrCreate) tim.Start() t.Start() dst = DownStatus.Downloading RaiseEvent DownloadStarted(Me, New EventArgs) End Sub Public Sub AbortDownload() dst = DownStatus.NoOperation t.Abort() tim.Stop() ds.Close() ss.Close() RaiseEvent DownloadAborted(Me, New EventArgs) End Sub Public Sub PauseDownload() dst = DownStatus.Paused t.Suspend() tim.Stop() RaiseEvent DownloadPaused(Me, New EventArgs) End Sub Public Sub ResumeDownload() tim.Start() t.Resume() dst = DownStatus.Downloading RaiseEvent DownloadResumed(Me, New EventArgs) End Sub #End Region #Region "Private methods" Private Sub Download() While True Try ds.WriteByte(ss.ReadByte) Catch Exit While End Try b += 1 Application.DoEvents() RaiseEvent DownloadProgressChanged(Me, New EventArgs) End While tim.Stop() ds.Close() ss.Close() dst = DownStatus.Completed RaiseEvent DownloadCompleted(Me, New EventArgs) End Sub #End Region #Region "Private events" Private Sub tim_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tim.Tick sec += 1 v = b / sec End Sub #End Region End Class
Dimmi che velocità riesci a raggiungere
aaa
09/07/09 14:37
riseofapocalypse
Azz che lento! xD però...come intendi procedere con i Socket? Io non ho mai provato a scaricare file con un Socket e non so nemmeno a che metodi di connessione si può fare riferimento in questo caso
aaa
09/07/09 14:48
GoLDBeRG
il problema è che non lo so nemmeno io.... ma se lo hanno fatto i creatori dei download manager possiamo farlo anche noi non credi.....
aaa
09/07/09 14:52
riseofapocalypse
Beh certo xD ho provato a cercare qualcosa, però ora mi sono ricordato che forse con i comandi che utilizza Telnet si può anche scaricare!
Ho appena provato a connettermi al Server e scaricare il file "Colossus.zip":
Ma la risposta del Server è questa:
Qualcuno sa spiegarmi il motivo?
Ho appena provato a connettermi al Server e scaricare il file "Colossus.zip":
Dim s As New Net.Sockets.Socket(Net.Sockets.AddressFamily.InterNetwork, Net.Sockets.SocketType.Stream, Net.Sockets.ProtocolType.Tcp) s.Connect("colossus.altervista.org", 80) s.Send(System.Text.Encoding.ASCII.GetBytes("get /file/Colossus.zip" & Environment.NewLine))
Ma la risposta del Server è questa:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>501 Method Not Implemented</title> </head><body> <h1>Method Not Implemented</h1> <p>get to /file/Colossus.zip not supported.<br /> </p> </body></html>
Qualcuno sa spiegarmi il motivo?
Ultima modifica effettuata da riseofapocalypse 09/07/09 15:56
aaa
09/07/09 17:03
GoLDBeRG
è come se quella funzione fosse disabilitata.... volendo... visto che forse è colpa di altervista se è disabilitata... dovrei provare con un server dedicato dove setto io l'apache... e vedere se riesco ad abilitare quella funzione... pero' dove proviamo? mo vedo se riesco a parlare con qualcuno... il problema è che rejetto (HFS) su linux nn ce... va usato per forza apache uff.... forse ci vuole un altro comando al posto del get... nessuno su questo forum sa qualcosa?
forum.html.it/forum/showthread/…
vedi se ci puo servire....
forum.html.it/forum/showthread/…
vedi se ci puo servire....
Ultima modifica effettuata da GoLDBeRG 09/07/09 17:06
aaa