Logo ROOT   6.10/09
Reference Guide
Functions
MPSendRecv.cxx File Reference
#include "MPSendRecv.h"
#include "TBufferFile.h"
#include "MPCode.h"
#include <memory>
Include dependency graph for MPSendRecv.cxx:

Functions

MPCodeBufPair MPRecv (TSocket *s)
 Receive message from a socket. More...
 
int MPSend (TSocket *s, unsigned code)
 Send a message with the specified code on the specified socket. More...
 

Function Documentation

◆ MPRecv()

MPCodeBufPair MPRecv ( TSocket s)

Receive message from a socket.

This standalone function can be used to read a message that has been sent via MPSend(). The smart pointer contained in the returned MPCodeBufPair is null if the message does not contain an object, otherwise it points to a TBufferFile. To retrieve the object from the buffer different methods must be used depending on the type of the object to be read:

Definition at line 54 of file MPSendRecv.cxx.

◆ MPSend()

int MPSend ( TSocket s,
unsigned  code 
)

Send a message with the specified code on the specified socket.

This standalone function can be used to send a code on a given socket. It does not check whether the socket connection is in a valid state. The message code can then be retrieved via MPRecv().
Note: only objects the headers of which have been parsed by cling can be sent by MPSend(). User-defined types can be made available to cling via a call like gSystem->ProcessLine("#include \"header.h""). Pointer types are not supported (with the exception of const char*), but the user can simply dereference the pointer and send the pointed object instead.
Note: for readability, codes should be enumerated as in EMPCode.

Parameters
sa pointer to a valid TSocket. No validity checks are performed
codethe code to be sent
Returns
the number of bytes sent, as per TSocket::SendRaw

Definition at line 32 of file MPSendRecv.cxx.