On 6/13/05, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote: > > Am 13.06.2005 um 09:37 schrieb Stephen Deasey: > > > > > Ns_SockListenTcp() should probably replace Ns_SockListenEx() with it's > > backlog parameter? The passed backlog should be checked, and if it's > > < 1, use the default from the config file. > > > > If this is the new recommended way to listen on sockets, I'd update > > all callers of the old Ns_SockListen(Ex) functions. People will cut > > 'n paste old code and continue the confusion. > > Well, I have left the Ns_SockListenEx() untouched. We might rename > it to Ns_SockListenTcp() to be more consistent but I did not want > to do that yet because I do not know what side-effects this may > have. > > > > > Hmm, Ns_SockListenUnix() doesn't actually call listen(). Is this > > right? Also, is a backlog parameter appropraite here, as in > > Ns_SockListenEx()? > > No, it does not. It just binds. > As well as the raw sockets; Ns_SockBindRow does not bind. > It just creates the socket. > > I did not want to add complete confusion so I followed the > TCP way: > > ListenXXX > BindXXX > > where XXX = Unix, Raw > > and > > Listen > Bind > > is reserved for TCP. The only real exception is Ns_SocketListenEx > which just adds one additional (backlog) parameter. > > Admitently, some calls are real misnomers as I already documented > in the funciton comment: > > * > * Ns_SockBindRaw -- > * > * Create a raw socket. It does not bind, hence the call name > * is not entirely correct but is on-pair with other types of > * sockets (udp, tcp, unix). > * > > In the process of cleanup, we might rectify/improve this and > give the calls more meaningful names.
Hmm, I don't think this naming scheme is clarifying things. The situation is that Ns_SockListenRaw() does not in fact listen. It call down to Ns_SockBindRaw() which does not in fact bind... I think we have to assume that programmers who need to use UDP and raw sockets have some idea of how they work. Pretending that they listen and/or bind is probably just going to confuse them. Isn't bind() the privileged call here, not listen? I think the hash look-up needs to be pushed down into the bind calls. Then ListenUdp and BindRaw can be dropped. And ListenUnix still needs a backlog arg... Oh, and Ns_SockListenUnix(char *path) is yet another thing that won't work with the Tcl VFS... :-)