开发者

Does posix aio in linux 2.6 support socket file descriptor?

I've seached such ques开发者_如何学Pythontion in google and got different answers.I cann't determine whether posix aio in linux 2.6 support socket file descriptor or not.

if it support tcp socket,does the aiocb.aio_offset=0 relative to the first byte readed from the tcp socket fd?

if it doesn't,does any asynchronous io library in linux support socket fd?


A comment above states that aio does not support sockets. You ask for possible alternatives.

The obvious ones are:

  • use an event driven programming model, either produced by hand using poll(2) or what have you or via a library like Niels Provos' "libevent"
  • use threads

I generally prefer the event driven way of doing things, and generally use libevent, which is documented here: http://libevent.org/

Bear in mind, however, that event driven programming is rather heavily different from what you may be used to in program organization. Threads are conceptually similar, although often less efficient when handling large numbers of sockets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜