<div dir="ltr"><div>Hello,</div><div><br></div><div>I have the following loop in a tcp client program that sends forms typed by</div><div>user at the terminal to a listening server, and receives such forms typed by</div><div>other clients (broadcast to all clients by the server).</div><div>  </div><div>(define server-msg-evt (wrap-evt in handle-server-msg))</div><div>(define rdy-to-send-evt (wrap-evt (standard-input-port) handle-rdy-to-send))</div><div><br></div><div>(let loop ()</div><div>  (sync rdy-to-send-evt server-msg-evt)</div><div>  (loop))</div><div><br></div><div>The problem is that the server-msg-evt isn't reliably ready when the server</div><div>flushes a message. I know the messages are being sent and flushed properly by</div><div>the server because if I type a new form on stdin and hit enter, I see the</div><div>following sequence:</div><div><br></div><div>1. Client processes new stdin form in handle-rdy-to-send</div><div>2. Client loops and calls sync</div><div>3. The server-msg-evt is *immediately* ready, and client handles the</div><div>   message in handle-server-msg.</div><div>Note: The message handled in step 3 may have been sent long before, but</div><div>the client remained blocked in sync until the (unrelated) stdin event</div><div>unblocked it.</div><div><br></div><div>The really weird part is that the client blocks in this manner even if I</div><div>change the sync to a sync/timeout!</div><div><br></div><div>Any clue as to what could be going on here? I'm running both client and server</div><div>in a DOS box on a Windows 7 machine.</div><div><br></div><div>Thanks,</div><div>Brett Stahlman</div><div><br></div></div>