Re: [ROOT] TServerSocket bug?

From: Volker Hejny (V.Hejny@fz-juelich.de)
Date: Mon Nov 19 2001 - 15:21:39 MET


On Mon, Nov 19, 2001 at 01:07:43PM +0100, Xavier Bertou wrote:
> >    interesting. Firstly, the TServerSocket connects correctly to the
> > specified port. What goes wrong is the TServerSocket::GetLocalPort()
> > call.
> 
> Well, doesn't look like:
> lpnp256 ~  /Raid/opt/root/bin/root
> [...]
> root [0] TServerSocket *ss=new TServerSocket(10005,kTRUE);
> 
> lpnp256 ~  lsof -P | grep root.exe | grep LISTEN
> root.exe  15571  bertou   11u  IPv4 406279                TCP *:5415

Looking at the code in TUnixSystem.cxx, the problem is quite obvious.

For example:
int TUnixSystem::UnixTcpService(int port, Bool_t reuse, int backlog,
                                int tcpwindowsize) {
...
  if ((sp = getservbyport(port, kProtocolName)))
        sport = sp->s_port;
  else
	sport = htons(port);
...
}

Only if no service is returned, the port is converted into network byte
order, but getservbyport() itself already want to have the port argument
in network byte order (see manpage)! That has to be changed at some 
other places as well.

Best regards,
Volker

-- 
Dr. Volker Hejny                Tel: 02461/616853                      ** 
Institut f. Kernphysik          Fax: 02461/613930                     **
---------------------------------------------------------------- **  ** ---  
Forschungszentrum Juelich GmbH, D-52425 Juelich                    **



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET