67 if (protocol ==
"root" || protocol ==
"xroot") {
70 Printf(
"checkUrl: specified URL does not identifies a running (x)rootd server: %s", url);
73 }
else if (protocol ==
"proof") {
76 Printf(
"checkUrl: specified URL does not identifies a running PROOF master: %s", url);
93 Printf(
"checkUrl: specified URL does not identifies a valid PROOF or data server: %s", url);
105 Printf(
"checkUrl: specified URL does not identifies a valid data or PROOF server: %s", url);
128 const char *host = gUrl.
GetHost();
134 Printf(
"pingXrootdAt: could not open connection to %s:%d", host, port);
139 memset(&initHS, 0,
sizeof(initHS));
142 int len =
sizeof(initHS);
143 int writeCount = s.
SendRaw(&initHS, len);
144 if (writeCount != len) {
146 Printf(
"pingXrootdAt: 1st: wrong number of bytes sent: %d (expected: %d)",
153 int readCount = s.
RecvRaw(&type, len);
154 if (readCount != len) {
156 Printf(
"pingXrootdAt: 1st: wrong number of bytes read: %d (expected: %d)",
166 readCount = s.
RecvRaw(&xbody, len);
167 if (readCount != len) {
169 Printf(
"pingXrootdAt: 2nd: wrong number of bytes read: %d (expected: %d)",
174 }
else if (type == 8) {
177 Printf(
"pingXrootdAt: server is ROOTD");
182 Printf(
"pingXrootdAt: unknown server type: %d", type);
199 const char *host = gUrl.
GetHost();
205 Printf(
"pingXproofdAt: could not open connection to %s:%d", host, port);
211 memset(&initHS, 0,
sizeof(initHS));
212 initHS.third = (int)
host2net((
int)1);
213 int len =
sizeof(initHS);
214 writeCount = s.
SendRaw(&initHS, len);
215 if (writeCount != len) {
217 Printf(
"pingXproofdAt: 1st: wrong number of bytes sent: %d (expected: %d)",
225 writeCount = s.
SendRaw(&dum[0],
sizeof(dum));
226 if (writeCount !=
sizeof(dum)) {
228 Printf(
"pingXproofdAt: 2nd: wrong number of bytes sent: %d (expected: %d)",
229 writeCount, (
int)
sizeof(dum));
235 int readCount = s.
RecvRaw(&type, len);
236 if (readCount != len) {
238 Printf(
"pingXproofdAt: 1st: wrong number of bytes read: %d (expected: %d)",
248 readCount = s.
RecvRaw(&xbody, len);
249 if (readCount != len) {
251 Printf(
"pingXproofdAt: 2nd: wrong number of bytes read: %d (expected: %d)",
255 xbody.protover =
net2host(xbody.protover);
256 xbody.msgval =
net2host(xbody.msglen);
257 xbody.msglen =
net2host(xbody.msgval);
259 }
else if (type == 8) {
262 Printf(
"pingXproofdAt: server is PROOFD");
267 Printf(
"pingXproofdAt: unknown server type: %d", type);
const char * GetHost() const
virtual Bool_t IsValid() const
This class represents a WWW compatible URL.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
const char * GetProtocol() const
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
UShort_t net2host(UShort_t x)
R__EXTERN TSystem * gSystem
Int_t pingServerAt()
Check if service is running at 'url' Return 0 if OK -1 if nothing is listening at the URL 1 if not a ...
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Int_t checkUrl(const char *url, const char *flog, bool def_proof)
Check if something is running at gUrl Return 0 if OK and data server 1 if OK and PROOF server -1 if n...
Bool_t R_ISDIR(Int_t mode)
void SetOptions(const char *opt)
Int_t pingXproofdAt()
Check if a XrdProofd service is running on 'port' at 'host' Return 0 if OK -1 if nothing is listening...
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
UShort_t host2net(UShort_t x)
Int_t pingXrootdAt()
Check if a XrdXrootd service is running on 'port' at 'host' Return 0 if OK -1 if nothing is listening...