Limits on sending strings with TSocket

Hi.

I have noticed that when I try to send a ridiculously large string (say, 200k characters) via a TSocket, I run into problems either at the sending or the receiving end:

  • Sometimes TSocket::Send(const char *) hangs.
  • Other times it is TSocket::Recv(TMessage &) that throws an exception.

I know that ROOT uses C-style strings for the transfer, so this ought to fail at some point. I was wondering if anyone knows what a reasonable/safe string size would be.

Thanks.

–Christos

Forgot to mention which ROOT version I am working with:

 which root
/afs/cern.ch/cms/external/lcg/external/root/5.10.00c/slc3_ia32_gcc323/root/bin/root

Hi Christos,

for me it seems to work. Can you mail me a small client and server script that fails / hangs for you.

Cheers, Fons.

It is not that easy to reproduce with a small ROOT macro. :slight_smile:

I wonder if that means the problem is somewhere else in my code… Let me get back to you.

Cheers.

I did manage to reproduce the problem, and I think I know what causes it.

The problem shows up when I try sending very large strings (holding a few hundred thousand characters) and either the sender’s or the receiver’s TSocket operate in non-blocking mode.

So, since the receiver in my program cannot be indefinitely in “listening mode”, I had to do something like this:

recv_socket->SetOption(kNoBlock, kFALSE);

if(recv_socket->Select(TSocket::Read, 100)) // wait for 100 msecs;
   read_string();
else
   do_something_else_and_check_later();