Hi Kyle,
I use TSocket in a similar application without problems. One difference
is that I communicate to the server side that the client connection is
shutting down before disconnecting, so that the server side can properly
shut down it's end of the socket, e.g.
// Client:
TSocket *s = new TSocket("serverhost",9090);
...
s -> Send("Shutdown");
delete s; s = 0; // destructor calls Close()
//Server:
TServerSocket* serversocket = TServerSocket(9090,kTRUE);
TSocket* s = serversocket -> Accept();
....
delete s; s = 0; // upon receipt of "Shutdown" message
-Sue
stevenkj wrote:
> Hello,
>
> I'm having real trouble right now with getting socket
> communication to work in root (Version 3.03/07 14 August 2002).
> I'm opening tscoket in a loop
>
> TSocket *s = new TSocket("localhost", 9090);
>
> then transfer histograms across the tsocket,
>
> s->Recv(mess_in);
> if (mess_in){
> if (mess_in->What() == kMESS_OBJECT)
> HTrksPSec = (TH1F *)mess_in->ReadObject(mess_in->GetClass());
> else {
> cout << "***Unexpected message***" << endl;
> if (mess_in->What() == kMESS_STRING)
> { char errstr[64]; mess_in->ReadString(errstr, 64);
> printf("%s\n", errstr); }
> }
> }
> I then close the tsocket before continuing in another loop iteration.
> s->Close()
>
> ps. I tried s->Close("force"); which didn't work either.
>
> The problem is that root doesn't seem to close the socket properly
> which is causing serious problems with our online monitoring (see mail
> below) & is starting to hurt our trigger comissioning. Has anyone ever
> seen this before, is it a known problem, is there a solution ?
>
> Kyle.
>
> ---------- Forwarded message ----------
> Date: Fri, 07 Feb 2003 17:12:19 -0600 (CST)
> From: Stu Fuess <fuess@fnal.gov>
> To: Kyle Stevenson <stevenkj@fnal.gov>
> Subject: root problem
>
> We looked at file descriptor usage:
>
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1016
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1018
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1020
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1024
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1024
> [root@d0ol43 ~]# ls -1 /proc/23124/fd | wc -l
> 1024
>
> It hits the kernel limit of 1024 files per process max.
>
> where 23124 was the pid of
> ../../bin/Linux2.4-KCC_4_0/l1CTT_examine_x -rcp ../rcp/runol_vsvx_framework.rcp
>
> see from netstat -a that CLOSE_WAIT sockets never go away:
>
> tcp 1 0 localhost.localdom:9090 localhost.localdo:39646 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:38110 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:40157 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:39133 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:39389 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:38365 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:41180 CLOSE_WAIT
> tcp 1 0 localhost.localdom:9090 localhost.localdo:38620 CLOSE_WAIT
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET