Results 1 to 2 of 2

Thread: Sending large amount of data useing winsock, and it slows my application?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Question

    This is my code:

    [code]
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Public Function SendLIST(index As Integer)
    Dim FreeF As Integer
    Dim LocData() As Byte
    Dim LenData As Long
    Dim sendloop As Long

    FreeF = FreeFile

    Open "D:\PROGRAM\List.txt" For Binary As #FreeF

    ReDim LocData(1 To 2048) As Byte ' Work in 2kb chunks

    LenData = LOF(FreeF) ' Get length of file

    For sendloop = 1 To LenData \ 2048 ' Go through file

    Get #FreeF, , LocData 'Get data from the file nCnt is from where to start the get

    Form1.Winsock1(index).SendData LocData 'Send the chunk

    Next

    If LenData Mod 2048 <> 0 Then ' If there is any left over at the end

    ReDim LocData(1 To LenData Mod 2048) As Byte ' Clear up the leftovers

    Get #FreeF, , LocData 'Get data from the file nCnt is from where to start the get

    Form1.Winsock1(index).SendData LocData 'Send the chunk

    End If

    Close #FreeF ' Close the file

    Sleep 200 ' Let computer catch up
    End Function

    [\code]

    Is their any where in their where I can add a command that will make sure my program does not go ape **** on me, so it does other stuff everynow and then?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Do you mean
    Code:
    DoEvents
    ?

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