Re: [ROOT] TServerSocket bug?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Nov 21 2001 - 08:06:18 MET


Hi Volker,

   great, I overlooked that. Fixed in my version and in CVS as soon as I 
am back from New Delhi. Many eyeballs make all bugs shallow :-)

Cheers, Fons.


On Mon, Nov 19, 2001 at 03:21:39PM +0100, Volker Hejny wrote:
> 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                    **

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



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