#include <TSocket.h>
Public Member Functions | |
TSocket () | |
Constructor with an address and a port. | |
~TSocket () | |
Destructor. | |
TReturnCode | connect (const TInetAddress &address, int port) |
Function connecting to the specified address. | |
TReturnCode | close () |
Close the current connection. | |
bool | isConnected () const |
Check if the socket is connected to some address at the moment. | |
TReturnCode | send (const TString &payload) |
Function sending a message to the connected address. |
Very simple wrapper around POSIX sockets
Since ROOT's TSocket is not fit to be used in TFileAccessTracer's destructor (as some ROOT infrastructure may not be available by the time the destructor is called), we need our own simple implementation instead.
Most of the implementation is simply a copy of the code from TUnixSystem. Slightly simplified in some cases where we don't need the flexibility of the ROOT implementation.
TReturnCode xAOD::TSocket::connect | ( | const TInetAddress & | address, | |
int | port | |||
) |
Function connecting to the specified address.
It turns out that translating a string address name into an integer address that the connect(...) function understands, is no easy feat. So instead we leave that up to ROOT. This translation just needs to be done "early enough" in the job when ROOT can still do it.
address | The address to send the data to | |
port | The port number to connect to returns The usual return codes... |
TReturnCode xAOD::TSocket::send | ( | const TString & | payload | ) |
Function sending a message to the connected address.
This function is custom made for our use case. It sends HTML style information to the connected server.
payload | The HTML style payload to send to the server |