Subject: Re: Proposal: socketfrom()
To: None <tls@rek.tjls.com>
From: Matt Thomas <matt@3am-software.com>
List: tech-net
Date: 07/05/2007 11:00:27
Thor Lancelot Simon wrote:
> I have an application that makes outbound TCP connections at a very high
> rate, so high that the overhead of additional system calls to set socket
> options considerably impacts performance.
> 
> I could partially address this by adding a system call that sets multiple
> socket options at once (which, I think, would be a better API than
> setsockopt() anyway) but that gets rid of _all but one_ system call to
> set up the socket before connect(); I want to get rid of them all.
> 
> I'd like to make it possible to set options on one "template" or "master"
> socket and then have them inherited by children, as listen()/accept() make
> possible for the other direction.  I'm thinking of something along the lines
> of this:
> 
> int socketfrom(int template, int domain, int type, int protocol);
> 
> Which would return a new socket using the socket options already set on
> socket "template".  If domain, type, and protocol don't match, this is
> an error (or perhaps it would be best to omit them entirely and just
> have one argument, the template socket.

new_fd = socketclone(int template_fd);

Would be my suggestion.  What about non-socket level options (IP, TCP, etc.)?



-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this message.