Results 1 to 10 of 10

Thread: Multiple File Transfers! HELPPPPP!

Hybrid View

  1. #1

    Thread Starter
    Addicted Member WAcKeD's Avatar
    Join Date
    Aug 2000
    Posts
    211

    Exclamation Multiple File Transfers! HELPPPPP!

    After the 30th million post, I am hoping outta the 24,000 members, at least one has the coding for multiple file transfers using winsock. This is gonna be my last post regarding the file transfering, cuz I'm officially sick of asking the questions and coming up with responses that members give simply to increase their post count. If you are gonna post a simple one sentance response, please don't. I am serious in looking for this bit of coding, and it seems as though every method you guys have givin me is laggy or too memory intensive. Now, anyone who knows how to perform a multiple winsock file transfer, please let me know (smash?). Thanks!
    Thankz,
    WAcKeD

  2. #2
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    Easy Tiger

    I`m supposta be the grumpy one.


  3. #3
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I am sorry that I don't have any code right now but, I was gonna say that I am developing a chat program that will, hopefully, support multiple files transfer. You can either wait or somebody else will able to write up some code for you. You can do that yourself too if you extend and follow this suggestion:
    Whenever you are starting a new file transfer, you load a new winsock control out of an array, use that winsock to connect to the remote computer from wher you are getting the file, and then keep track of all those downloads by using some kind of array or a listbox/listview control.
    Baaaaaaaaah

  4. #4

    Thread Starter
    Addicted Member WAcKeD's Avatar
    Join Date
    Aug 2000
    Posts
    211
    Yeah, I've tried to before, but I kept failing at it cuz I just lost track of everything (too many things going at once). Anyway, the way I did it was too laggy for any machine, so I deleted it. I hope someone out there knows what they're doing, and a way to do it.
    Thankz,
    WAcKeD

  5. #5
    Hyperactive Member Hampster's Avatar
    Join Date
    Feb 2001
    Location
    On my hamster wheel.
    Posts
    374

  6. #6
    Lively Member
    Join Date
    Nov 2000
    Location
    Sugar Grove, IL
    Posts
    99
    Relax already, sheesh, we all can't sit here and read this board 24 - 7.

    But since you asked so nicely, I am gonna show ya what you need. I have done multiple downloads through IRC, and this code works great for me. There are probably a couple of variables dimensioned that you do not need, so don't worry about them. The way I have it set up is I have a MDIChild form set up with a Winsock on it, and I just make a new instance of it everytime I want to download a new file. Set up a MDIChild form named whatever, mine's named DCCFileRecieved.

    VB Code:
    1. Public fileName As String
    2. Public senderName As String
    3. Public fileSize As String
    4. Public I As Integer 'hold the file number of the opened file
    5. Public totalSize As Double
    6. Public goodFile As Boolean
    7. Public lastTime As Long
    8.  
    9.  
    10. Public Sub startNewSession(ip As String, port As String)
    11.     If WS.State <> sckClosed Then
    12.         WS.Close
    13.     End If
    14.     WS.Connect ip, port
    15.     T.Enabled = True
    16. End Sub
    17.  
    18. Private Sub WS_DataArrival(ByVal bytesTotal As Long)
    19.     On Error GoTo err:
    20.     Dim strData As String
    21.     Dim size
    22.     WS.GetData strData, vbString
    23.     Print #I, strData;
    24.     size = LOF(I)
    25.     totalSize = totalSize + bytesTotal
    26.     lblRecieved.Caption = FormatNumber((totalSize / 1024), 2) & " K"
    27.     PB.Value = totalSize
    28.     If totalSize >= lblSize.Caption Then
    29.         Close #I
    30.         goodFile = True
    31.         WS.SendData lblSize.Caption
    32.         WS.Close
    33.         fileRecieveDone fileName, lblUserName.Caption
    34.         Unload Me
    35.     End If
    36. err:
    37.    If err.Number <> 0 Then
    38.         If WS.State = 6 Then
    39.             Exit Sub
    40.         ElseIf err.Number = 11 Then
    41.             Resume Next
    42.         Else
    43.             Resume Next
    44.         End If
    45.     End If
    46. End Sub
    47.  
    48.  
    49. Public Sub openFile()
    50.     I = FreeFile
    51.     If Len(App.Path & "\Download\" & fileName) > 0 Then 'looks to see if file exists
    52.         Open App.Path & "\Download\" & fileName For Output As I
    53.         Close #I
    54.     End If
    55.     Open App.Path & "\Download\" & fileName For Output As I
    56. End Sub
    57.  
    58. Private Sub T_Timer()
    59.     On Error Resume Next
    60.     DoEvents
    61.     Dim total As Double
    62.     total = (totalSize - lastTime)
    63.     lblSpeed.Caption = FormatNumber((total / 1024), 1) & " Kps"
    64.     lblTime.Caption = ((lblSize.Caption - totalSize) / total) * 60
    65.     lastTime = totalSize 'lastTime is the variable holding the size of the file the last
    66.                          'time the timer was called
    67. End Sub
    68.  
    69. Private Sub WS_Close()
    70.     If goodFile Then
    71.         Me.Caption = "File Recieved Successfully"
    72.     Else
    73.         Me.Caption = "Incomplete File"
    74.     End If
    75. End Sub

    On another form:

    To download a file, use yourFormNameHere.startNewSession(ip, port)
    In case of a water landing, my head may be used as a flotation device.

  7. #7

    Thread Starter
    Addicted Member WAcKeD's Avatar
    Join Date
    Aug 2000
    Posts
    211

    Thanks

    It looks good, thanks. Anyone have the multiple sending part of it now?
    Last edited by WAcKeD; Dec 7th, 2001 at 06:48 PM.
    Thankz,
    WAcKeD

  8. #8
    Lively Member
    Join Date
    Nov 2000
    Location
    Sugar Grove, IL
    Posts
    99
    No problem. But ya gotta remember to be patient. I posted several times on subjects similiar to this, and got little, if any response. So I then had to do everything for myself, which taught me so much more than someone handing me some code and saying here, this is exactly what you are looking for. Not tryin to sound like an ass, just want ya to relax. Life's too short to get your panties in a bunch. :-)
    In case of a water landing, my head may be used as a flotation device.

  9. #9

    Thread Starter
    Addicted Member WAcKeD's Avatar
    Join Date
    Aug 2000
    Posts
    211
    I was thinking. Why not just make a class, then when someone wants to download, make a new one. What do you think?
    Thankz,
    WAcKeD

  10. #10

    Thread Starter
    Addicted Member WAcKeD's Avatar
    Join Date
    Aug 2000
    Posts
    211
    Okay, the recieving code works, now all I need is something that will allow me to send the file multiple times. Does anyone know how this is done? You could create a cls maybe, and when someone wants to download, just create a new one and tell it to connect to the other persons computer. If you have an easier way, let me know. thanks
    Thankz,
    WAcKeD

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