Results 1 to 4 of 4

Thread: Filemanager problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    1

    Filemanager problem

    Hello! Im coding a filemanager and I need some help.
    The download speed is very slow.

    The arrived packets are loaded into memory (4 kb/packet) and that also makes the program very slow. The packets should get into the file as soon as they arrived.
    Can you help me to fix the code? Code (Client side):

    VB Code:
    1. 'Module
    2. Public CurrentDirectory As String
    3. Public intFile As Integer
    4. Public lngFileSize As Long
    5. Public lngFileProg As Long
    6. Public StrFileName As String
    7. Public RequestedFile As String
    8. Public tmpstring As String
    9. Public screenshot As Boolean
    10. -------------------------------------------------------------------
    11.  
    12.  
    13. Private Sub ClientSck_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    14. Dim arrLines() As String
    15. Dim i As Integer
    16. Dim Lines As Long
    17. Dim All_data As String
    18. Dim Clean_Data As String
    19. Dim Temp_Data As String
    20. Dim NData() As String
    21. Dim FileBuffer As String
    22.  
    23. ClientSck(Index).GetData All_data, vbString
    24. NData = Split(All_data, "|")
    25. Select Case NData(0)
    26.  
    27.  
    28.  
    29.  
    30.         Case "SEND_FILE": lngFileSize = Int(NData(1)): Filemanager.ProgressBar.Max = lngFileSize: Filemanager.lblPercent.Caption = "0%": intFile = FreeFile
    31.                           lngFileSize = Int(NData(1)): Screencapture.PB.Max = lngFileSize
    32.                           SckNumber = lstConTable.ListItems.Item(lstConTable.SelectedItem.Index)
    33.                           If FileExists(StrFileName) Then
    34.                               Kill StrFileName: DoEvents
    35.                           End If
    36.                           Open StrFileName For Binary Access Write As intFile: ClientSck(SckNumber).SendData "ACPT_FILE" & "|" & RequestedFile: lngFileProg = 0
    37.  
    38.  
    39.  
    40.         Case "CHNK_DATA"
    41.             SckNumber = lstConTable.ListItems.Item(lstConTable.SelectedItem.Index)
    42.             All_data = Mid$(All_data, 11, Len(All_data) - 10)
    43.  
    44.             If (lngFileProg + 4096) < lngFileSize Then
    45.                 lngFileProg = lngFileProg + 4096
    46.                 Filemanager.ProgressBar.Value = Filemanager.ProgressBar.Value + 4096
    47.                 Filemanager.lblPercent.Caption = Format$((Filemanager.ProgressBar.Value / Filemanager.ProgressBar.Max * 100), "##.##") & "%"
    48.                 Screencapture.PB.Value = Screencapture.PB.Value + 4096
    49.                 Put intFile, , All_data
    50.                 ClientSck(SckNumber).SendData "CHNK_FILE"
    51.  
    52.             Else
    53.  
    54.                 All_data = Left$(All_data, lngFileSize - lngFileProg)
    55.                 Filemanager.ProgressBar.Value = Filemanager.ProgressBar.Max
    56.                 Filemanager.lblPercent.Caption = "100%"
    57.                 Put intFile, , All_data
    58.                 ClientSck(SckNumber).SendData "DONE_FILE"
    59.                 Close intFile
    60.                 Filemanager.ProgressBar.Value = 0
    61.                  Screencapture.PB.Value = 0
    62.                 Filemanager.lblPercent.Caption = vbNullString
    63.  
    64.                 If screenshot = True And StrFileName = App.Path & "\CompressedSS.cmp" Then
    65.                     screenshot = False
    66.                     DecompressFile App.Path & "\CompressedSS.cmp", App.Path & "\Screencapture.bmp"
    67.                     Kill App.Path & "\CompressedSS.cmp"
    68.                     Screencapture.Picture1.Picture = LoadPicture(App.Path & "\Screencapture.bmp")
    69.   Screencapture.Picture1.ScaleMode = 3
    70.     Screencapture.Picture1.AutoRedraw = True
    71.     Screencapture.Picture1.PaintPicture Screencapture.Picture1.Picture, _
    72.         0, 0, Screencapture.Picture1.ScaleWidth, Screencapture.Picture1.ScaleHeight, _
    73.         0, 0, _
    74.         Screencapture.Picture1.Picture.Width / 26.46, _
    75.         Screencapture.Picture1.Picture.Height / 26.46
    76.     Screencapture.Picture1 = Screencapture.Picture1.Image
    77.  
    78.                 Else
    79.  
    80.                     statBar.SimpleText = "Status: Command Executed"
    81.                     MsgBox "Download Finished" & vbNewLine & vbNewLine & "Total Recived: " & Format$(Filemanager.ProgressBar.Max, "###,###,###,###") & " bytes", vbOKOnly, "Nedladdnings status"
    82.  
    83.                 End If
    84.             End If
    Last edited by marjinz; Oct 27th, 2006 at 12:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width