Re: CSocket example (was Re: select is not working for me)
Re: CSocket example (was Re: select is not working for me)
- Subject: Re: CSocket example (was Re: select is not working for me)
- From: Larry Gerndt <email@hidden>
- Date: Tue, 21 Oct 2003 22:53:56 -0700
>
FYI, for a relatively simple example of how to use select, check out
>
the SocketCancel sample code.
>
>
http://developer.apple.com/samplecode/Sample_Code/Networking/SocketCancel.htm
Indeed, good advice. I was pointed to this by Quinn the other day and I've
spent the last few days incorporating the above sample code into my project.
I learned a lot from this sample, and I highly recommend it for anyone who
will be using asynchronous (i.e. non-blocking) sockets. It teaches not only
how to use select, but also how to use socketpair. His CSocket "class" (for
Cancelable Socket) creates three sockets, one is the primary I/O socket and
the other two are auxiliary in purpose, created by socketpair, and are used
in conjunction with the select statement to implement a very nice cancel
mechanism such that after cancel, any attempt to write or read the primary
socket will return ECANCELLED.
--
Larry Gerndt
AIM Handle: SonOfTheSonOfMan
Let the truth be told though the heavens fall -- James Garrison
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.