Results 1 to 3 of 3

Thread: Winsock problem..

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    1

    Question

    What i'm trying to do is make a program somewhat simaliar to Napster. Everything works great so far, execpt that when 2 users try to search for a file at the sametime.. It stops sending the information to the first user and starts on the second, then when the second user has received all the messages, it starts back up on the first. My question is, is there anyway to get it to do both searchs at the sametime?

    here is how i do the search:

    ****************

    Public Function SearchFolder(folderpath As String, SearchSTR As String, num As Integer)

    Dim thisFolder As Folder
    Dim sFolder As Folders
    Dim AllFiles As Files
    Dim fileItem As File, folderitem As Folder
    Dim tStream As TextStream
    Dim line As String
    Dim userid As String
    Dim fName As String
    Dim filedata As String
    Dim t As Integer
    Dim str11 As String
    Dim str12 As String

    Set thisFolder = Fsys.GetFolder(folderpath)
    Set sFolder = thisFolder.SubFolders
    Set AllFiles = thisFolder.Files


    For Each folderitem In sFolder

    DoEvents

    SearchFolder App.Path & "\data\files\", SearchSTR, num
    Next

    For Each fileItem In AllFiles

    DoEvents

    Set tStream = Fsys.OpenTextFile(fileItem.Path, ForReading, False)

    line = tStream.ReadLine
    userid = TrimNull(line)

    Do Until tStream.AtEndOfStream

    DoEvents
    line = tStream.ReadLine

    If InStr(1, line, SearchSTR, vbTextCompare) Then

    Sleep 140

    t = InStr(1, line, "::")

    If t Then

    str11 = Left(line, t - 1)
    str12 = Mid(line, t + 2, Len(line) - t)

    End If

    Sleep 110

    fName = GetFileName(str11)

    Call Sendout("[SRE]" & LCase(userid) & "::" & fName & "!L" & str12, num)

    End If

    Loop
    Next

    End Function

    ****************

    Thanks -
    Nate

  2. #2
    Guest
    You could use a timer, and instead of keep searing search one folder at a time when the timers fires an event, this way you don't have the problem that it get stuck in a loop nd needs to finish it first.


  3. #3
    New Member
    Join Date
    Jun 2000
    Posts
    3
    r u using the winsock api calls for your napster thingy or r u using the winsock control?


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