A network socket.
More...
#include <XrdClSocket.hh>
|
| | Socket (int socket=-1, SocketStatus status=Disconnected) |
| |
| virtual | ~Socket () |
| | Desctuctor. More...
|
| |
| Status | Initialize (int family=AF_INET) |
| | Initialize the socket. More...
|
| |
| Status | SetFlags (int flags) |
| | Set the socket flags (man fcntl) More...
|
| |
| Status | GetFlags (int &flags) |
| | Get the socket flags (man fcntl) More...
|
| |
| Status | GetSockOpt (int level, int optname, void *optval, socklen_t *optlen) |
| | Get socket options. More...
|
| |
| Status | SetSockOpt (int level, int optname, const void *optval, socklen_t optlen) |
| | Set socket options. More...
|
| |
| Status | Connect (const std::string &host, uint16_t port, uint16_t timout=10) |
| |
| Status | ConnectToAddress (const XrdNetAddr &addr, uint16_t timout=10) |
| |
| void | Close () |
| | Disconnect. More...
|
| |
| SocketStatus | GetStatus () const |
| | Get the socket status. More...
|
| |
| void | SetStatus (SocketStatus status) |
| | Set socket status - do not use unless you know what you're doing. More...
|
| |
| Status | ReadRaw (void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesRead) |
| |
| Status | WriteRaw (void *buffer, uint32_t size, int32_t timeout, uint32_t &bytesWritten) |
| |
| ssize_t | Send (void *buffer, uint32_t size) |
| |
| ssize_t | WriteV (iovec *iov, int iovcnt) |
| |
| int | GetFD () |
| | Get the file descriptor. More...
|
| |
| std::string | GetSockName () const |
| | Get the name of the socket. More...
|
| |
| std::string | GetPeerName () const |
| | Get the name of the remote peer. More...
|
| |
| std::string | GetName () const |
| | Get the string representation of the socket. More...
|
| |
| const XrdNetAddr & | GetServerAddress () const |
| | Get the server address. More...
|
| |
| void | SetChannelID (AnyObject *channelID) |
| |
| const AnyObject * | GetChannelID () const |
| |
|
| Status | Poll (bool readyForReading, bool readyForWriting, int32_t timeout) |
| |
Status of the socket.
| Enumerator |
|---|
| Disconnected |
The socket is disconnected.
|
| Connected |
The socket is connected.
|
| Connecting |
The connection process is in progress.
|
Constructor
- Parameters
-
| socket | already connected socket if available, -1 otherwise |
| status | status of a socket if available |
| virtual XrdCl::Socket::~Socket |
( |
| ) |
|
|
inlinevirtual |
| void XrdCl::Socket::Close |
( |
| ) |
|
| Status XrdCl::Socket::Connect |
( |
const std::string & |
host, |
|
|
uint16_t |
port, |
|
|
uint16_t |
timout = 10 |
|
) |
| |
Connect to the given host name
- Parameters
-
| host | name of the host to connect to |
| port | port to connect to |
| timout | timeout in seconds, 0 for no timeout handling (may be used for non blocking IO) |
| Status XrdCl::Socket::ConnectToAddress |
( |
const XrdNetAddr & |
addr, |
|
|
uint16_t |
timout = 10 |
|
) |
| |
Connect to the given host address
- Parameters
-
| addr | address of the host to connect to |
| timout | timeout in seconds, 0 for no timeout handling (may be used for non blocking IO) |
| const AnyObject* XrdCl::Socket::GetChannelID |
( |
| ) |
const |
|
inline |
Get Channel ID (an object that allows to identify all sockets corresponding to the same channel)
References pChannelID.
| int XrdCl::Socket::GetFD |
( |
| ) |
|
|
inline |
Get the file descriptor.
References pSocket.
| Status XrdCl::Socket::GetFlags |
( |
int & |
flags | ) |
|
Get the socket flags (man fcntl)
| std::string XrdCl::Socket::GetName |
( |
| ) |
const |
Get the string representation of the socket.
| std::string XrdCl::Socket::GetPeerName |
( |
| ) |
const |
Get the name of the remote peer.
| const XrdNetAddr& XrdCl::Socket::GetServerAddress |
( |
| ) |
const |
|
inline |
| std::string XrdCl::Socket::GetSockName |
( |
| ) |
const |
Get the name of the socket.
| Status XrdCl::Socket::GetSockOpt |
( |
int |
level, |
|
|
int |
optname, |
|
|
void * |
optval, |
|
|
socklen_t * |
optlen |
|
) |
| |
Get the socket status.
References pStatus.
| Status XrdCl::Socket::Initialize |
( |
int |
family = AF_INET | ) |
|
| Status XrdCl::Socket::Poll |
( |
bool |
readyForReading, |
|
|
bool |
readyForWriting, |
|
|
int32_t |
timeout |
|
) |
| |
|
private |
Poll the socket to see whether it is ready for IO
- Parameters
-
| readyForReading | poll for readiness to read |
| readyForWriting | poll for readiness to write |
| timeout | timeout in seconds, -1 to wait indefinitely |
- Returns
- stOK - ready for IO errSocketDisconnected - on disconnection errSocketError - on socket error errSocketTimeout - on socket timeout errInvalidOp - when called on a non connected socket
| Status XrdCl::Socket::ReadRaw |
( |
void * |
buffer, |
|
|
uint32_t |
size, |
|
|
int32_t |
timeout, |
|
|
uint32_t & |
bytesRead |
|
) |
| |
Read raw bytes from the socket
- Parameters
-
| buffer | data to be sent |
| size | size of the data buffer |
| timeout | timout value in seconds, -1 to wait indefinitely |
| bytesRead | the amount of data actually read |
| ssize_t XrdCl::Socket::Send |
( |
void * |
buffer, |
|
|
uint32_t |
size |
|
) |
| |
Portable wrapper around SIGPIPE free send
- Parameters
-
| buffer | : data to be written |
| size | : size of the data buffer |
- Returns
- : the amount of data actually written
| void XrdCl::Socket::SetChannelID |
( |
AnyObject * |
channelID | ) |
|
|
inline |
Set Channel ID (an object that allows to identify all sockets corresponding to the same channel)
References pChannelID.
| Status XrdCl::Socket::SetFlags |
( |
int |
flags | ) |
|
Set the socket flags (man fcntl)
| Status XrdCl::Socket::SetSockOpt |
( |
int |
level, |
|
|
int |
optname, |
|
|
const void * |
optval, |
|
|
socklen_t |
optlen |
|
) |
| |
Set socket status - do not use unless you know what you're doing.
References pStatus.
| Status XrdCl::Socket::WriteRaw |
( |
void * |
buffer, |
|
|
uint32_t |
size, |
|
|
int32_t |
timeout, |
|
|
uint32_t & |
bytesWritten |
|
) |
| |
Write raw bytes to the socket
- Parameters
-
| buffer | data to be written |
| size | size of the data buffer |
| timeout | timeout value in seconds, -1 to wait indefinitely |
| bytesWritten | the amount of data actually written |
| ssize_t XrdCl::Socket::WriteV |
( |
iovec * |
iov, |
|
|
int |
iovcnt |
|
) |
| |
Wrapper around writev
- Parameters
-
| iov | : buffers to be written |
| iovcnt | : number of buffers |
- Returns
- : the amount of data actually written
| std::string XrdCl::Socket::pName |
|
mutableprivate |
| std::string XrdCl::Socket::pPeerName |
|
mutableprivate |
| int XrdCl::Socket::pProtocolFamily |
|
private |
| int XrdCl::Socket::pSocket |
|
private |
| std::string XrdCl::Socket::pSockName |
|
mutableprivate |
The documentation for this class was generated from the following file: