Re: TCP/IP
Re: TCP/IP
- Subject: Re: TCP/IP
- From: Tim Hewett <email@hidden>
- Date: Tue, 15 Feb 2005 18:26:32 +0000
Mai,
Check out the select() system call, it is mentioned in the man page
for accept(). The select() call lets you have the OS watch a number
of file descriptors concurrently for when certain conditions exist
on them, e.g. when a socket has data ready to be read from it. It
allows you to specify a timeout, which will give you what you want.
Just use select() to watch for when your rendezvous socket descriptor
has readable data on it, it will block until it has or until the timeout
expires. Then you know for sure that when you call accept() on
that descriptor, there will be a connection request sat there for it
to service and so it will return immediately.
The poll() call is similar to select(), it is also worth checking out
in case it suits your scenario better.
Tim.
On 15 Feb 2005, at 18:12, email@hidden wrote:
Hi all,
I know it's not correct place to ask question since it does not relate
to cocoa but I do not know where I ask.
I search on the web for a day but can not find a way to do it, so I
must ask you guys.
If any one know about it, please post any idea. I'm really appreciate.
How can I set a time out for accept(), so the server doesn't to wait
for client forever? I see there are settimeout() or setSoTimeout() for
socket, but both of them I can not use it somehow.
Thanks in advance.
Mai
MPL - SIO
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden