Problem with RecvRaw

Hello Paulo,

You can set the socket to non-blocking on the client side
and monitor it with select: it will then get what the server
sends, whatever the length.

Something like this:

TSocket *fSock = new TSocket(server,port);
fSock->SetOption(kNoBlock, 1);
char buffer[40] = {0};
TMonitor *mon = new TMonitor;
mon->Add(fSock);
TSocket *fSockRead = mon->Select();
fSockRead->RecvRaw(buffer,sizeof(buffer));
printf("%s (errno: %d)\n",buffer,gSystem->GetErrno());

gSystem->GetErrno() will return EAGAIN (=11), because
in principle there might be other info to be received; so,
if you expect more you should loop until you get all the
bytes you expect.

As an alternative, you can have a look at the file
rpdutils/src/net.cxx: it contains examples of functions
to send and receive messages in a non-ROOT environment
correctly interfaced with TSocket::Recv and TSocket:Send
functions.

Hope it helps.

Kind regards,

Gerri Ganis