Results 1 to 4 of 4

Thread: Winsock sleep

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Unhappy

    Is there an api function to make a winsock control sleep for a certain amount of time without using a timer?

    In my program i have a winsock with an index to be able to load a couple of them at a time, and if a connection is detected lets say on winsock(5) then the winsock will send over the data it is sappose to and sleep for a couple seconds.

    Can anybody help me in making the winsock fall asleep with API or some other control?? Anything but a timer!

  2. #2
    Lively Member rekcus's Avatar
    Join Date
    Jan 1999
    Location
    Kuala Lumpur
    Posts
    122

    Cool

    Try the GetTickCount API. But what's so wrong with the timer control?

    Rgrds,
    penyou!

    "The code bytes.."

  3. #3

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Thumbs up

    Timers are to hard to control, for me anyway aspecially if i have winsock(0-100) loaded, id have to make (0-100) timers for every winsock, and that would just take up to much resources, and slow things down and all that ****.
    But thanks for the GetTickCount API, im not exactly sure how to use it yet but im sure ill figure out how it works. For now it gives me a value of 931123... i dont know how to read that but whatever, ill figure it out. Thanks for the reply, appriciate it!
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  4. #4
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126
    Use a combination of Sleep and DoEvents, that will be more fuctional in your situation... see example code below...

    Look up 'Sleep' in your API guide and use its declation.
    Sleep only requires 1 parameter, that being duraiton in miliseconds.

    Sleep 1000

    1 second pause via API and system

    'Example loop, causes problems with loading stress
    'etc.. as you explained in your previous post...
    For X = 1 to 100
    Load SckSocket(x).UBound +1
    SckSocket(x).LocalPort = X
    SckSocket(x).Connect HostName(x)
    Next X


    'More effcient and productive loop
    For X = 1 to 100
    Load SckSocket(x).UBound +1
    SckSocket(x).LocalPort = X
    SckSocket(x).Connect HostName(x)

    'Cause a pause and let system dump buffers etc...

    DoEvents
    Sleep 400
    DoEvents

    Next X


    Any problems just reply to this post.
    Regards,

    Paul Rivoli
    ---------------------
    [email protected]
    http://members.dingoblue.net.au/~privoli

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