Results 1 to 4 of 4

Thread: winsock - Simple question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    I made a client/server program and I make use of a delay function which consist of Do Events in order to delay the sending of data to the receipient. So far my program is ok.

    But when I want to do concurrent sending between client and server, I found out that the Do Event statememnt will prevent my program to intercept incoming data from the winsock control making the sync between client and server fail. How do I solve this problem ? Is there any other method to delay my data sending using winsock without using the Do Event ?

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    Why did you need to delay the sending ?
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  3. #3
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Not sure exactly what you mean but...

    after receiving data you must run a DoEvents

    sock.getdata strBuffer
    doEvents
    sock.SendData "whatever"
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    GetTickCount API function

    May be you can use GetTickCount API function in your delay routine like below. So that you can have a flexible delay interval. I did used this in my Winsock data sending program & it work great. Hope it can help you too.

    Code:
    Option Explicit
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Private t1 As Long
    Private t2 As Long
    
    Private Sub DELAY(ByVal interval As Long)
    t1 = GetTickCount
    t2 = 0
    Do While t2 - t1 < interval
        DoEvents
        t2 = GetTickCount
    Loop
    End Sub

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