Subject: Re: Socket buffers allocations
To: None <tech-net@netbsd.org>
From: Bharat Joshi <bharat.josh@gmail.com>
List: tech-net
Date: 01/12/2007 16:24:11
Hi Christian,
Thansk a lot for quick reply.
>> I am developing an application where I need to check whether a
>> socket is ready for write or not. I can do that using select, poll or
>> kqueue and I have chosen 'kqueue' to do it.
> Excellent choice.
>> Before adding the socket to 'kqueue', I want to check if there
>> is enough space in socket buffer for a write to be successful.
> Why before? Well, see FIONSPACE in ioctl(2).
I just found that this has been introduced in new revision. I was
using NetBSD 2.0.
>> My first question is that is there a IOCTL/GETSOCKOPT option using which I
>> can find out the space available in the send socket buffer?
> See kqueue(2) and EVFILT_WRITE:
> EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever
> it is possible to write to the descriptor. For sockets,
> pipes, fifos, and ttys, data will contain the amount of
> space remaining in the write buffer.
Yes. I had looked at it when I choose to use 'kqueue'.
If someone can answer my other questions as well, I would be able to
decide how and what to use in my application.
Thanks & Regards,
Bharat
PS: I am sorry that I am not subscribed to tech-net mailing list and I
forgot to ask for a cc to my reply as well. Please cc your reply to my
mail id as well.