Stories
Slash Boxes
Comments

SoylentNews is people

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by shortscreen on Tuesday July 24 2018, @08:47AM (3 children)

    by shortscreen (2252) on Tuesday July 24 2018, @08:47AM (#711639) Journal

    Winsock 1 was designed to work on both WinNT and Win3.x, the latter of which did not have preemptive multitasking. There were three different schemes for doing I/O: blocking, non-blocking, and asynchronous. The async one sounded neat, it used window messages to communicate the status of I/O operations to your application. AFAIK that required having a window, which made it tricky to use in a command-line program. With blocking I/O, function calls would not return until the operation finished. If you didn't set a timeout value then your thread could be stuck indefinitely waiting for data (although Win3.x didn't really have threads so Winsock would yield to the OS and the OS could then call your functions even while you thought you were waiting for data). With non-blocking I/O the calls would return immediately but without anything necessarily happening. So you'd just keep calling the function and check to see whether the data showed up or not.

    I once made a thing that used Winsock 1 to download a file. I used non-blocking. Emptied the receive buffer and then slept for 20ms so the CPU wouldn't be tied up continuously. With a high-bandwidth connection that could fill the buffer in less than 20ms, throughput was suboptimal.

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 2) by coolgopher on Tuesday July 24 2018, @01:49PM

    by coolgopher (1157) on Tuesday July 24 2018, @01:49PM (#711714)

    What about the I/O Completion Ports? Or that only came in with Winsock 2 & NT4.0? It's been a while...

  • (Score: 2) by DannyB on Tuesday July 24 2018, @06:30PM

    by DannyB (5839) Subscriber Badge on Tuesday July 24 2018, @06:30PM (#711818) Journal

    Phishing Poll?

    --
    People today are educated enough to repeat what they are taught but not to question what they are taught.
  • (Score: 2) by isj on Friday July 27 2018, @12:26PM

    by isj (5249) on Friday July 27 2018, @12:26PM (#713640) Homepage

    My company needed a program to download files, and calling the command-line ftp tool in windows 3.11 wasn't good enough (users got confused about the terminal window).
    So I implemented a tiny FTP download client and used the asynchronous feature of winsock. That worked surprisingly well - it downloaded twice as fast as winsock's 'ftp' and there were no noticeable slowdown in the UI.