I want to write an event loop single threaded web server to deal with each request in Racket. I see there are select method in unix that I can call, Is there 开发者_如何转开发anything similar in Racket API that I can call? or I should write my own select method which is to polling the ready fds? Thanks in advance!
Apologies if I'm misunderstanding your question, but it sounds like you'll probably want to use tcp-listen on certain ports; success here will create input ports. In order to synchronize on multiple open input ports, check out "synchronizable events"; you can use 'sync' on a whole bunch of open ports simultaneously.
I would be remiss if I failed to add that there's a complete web server included with Racket; I'm assuming that you have your own reasons for wanting to re-implement this.
精彩评论