Re: Asynchronous Socket Code
Re: Asynchronous Socket Code
- Subject: Re: Asynchronous Socket Code
- From: Dan Watson <email@hidden>
- Date: Mon, 09 Jul 2001 18:29:27 -0400
I wrote my own little bsd socket wrapper class to do just this. it basically
detaches a thread to poll for data, and calls dataAvailable when it gets
some. you just need to subclass it and override the event functions
(connected, disconnected, dataAvailable, error) to do what you want.
I'm not sure how efficient this approach is, and I haven't looked into
CFSockets yet, but this works well enough for me :)
I've posted an archive of what I've written. it's uncommented, but should be
fairly self explanitory. feel free to use and modify. it's at:
http://vertigo.avara.net/TCPSocket.tar.gz
hope this helps,
dan
>
On Monday, July 9, 2001, at 11:36 AM, Graham Wihlidal wrote:
>
>
> I am trying to find some code or library for having asynchronous socket
>
> code. Something like, installing an event handler which is called
>
> whenever data is received, but still allow the user to click buttons
>
> in the app with no slow down. I tried writing something myself, but I
>
> couldn't get the polling to stay away from a loop (which locks the app
>
> until it breaks)
>
>
CFSocket will do exactly this (and very little more). If you want more
>
extensive socket support, you can look at (for example) the
>
OmniNetworking framework.
>
>
Douglas Davidson
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
----------------------------------------------------------------------------
dan watson
email@hidden