Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPSocket.cxx
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Fons Rademakers 22/1/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// TPSocket //
15// //
16// This class implements parallel client sockets. A parallel socket is //
17// an endpoint for communication between two machines. It is parallel //
18// because several TSockets are open at the same time to the same //
19// destination. This especially speeds up communication over Big Fat //
20// Pipes (i.e. high bandwidth, high latency WAN connections). //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TPSocket.h"
25#include "TUrl.h"
26#include "TServerSocket.h"
27#include "TMonitor.h"
28#include "TSystem.h"
29#include "TMessage.h"
30#include "Bytes.h"
31#include "TROOT.h"
32#include "TError.h"
33#include "TVirtualMutex.h"
34
35
36////////////////////////////////////////////////////////////////////////////////
37/// Create a parallel socket. Connect to the named service at address addr.
38/// Use tcpwindowsize to specify the size of the receive buffer, it has
39/// to be specified here to make sure the window scale option is set (for
40/// tcpwindowsize > 65KB and for platforms supporting window scaling).
41/// Returns when connection has been accepted by remote side. Use IsValid()
42/// to check the validity of the socket. Every socket is added to the TROOT
43/// sockets list which will make sure that any open sockets are properly
44/// closed on program termination.
45
52
53////////////////////////////////////////////////////////////////////////////////
54/// Create a parallel socket. Connect to the specified port # at address addr.
55/// Use tcpwindowsize to specify the size of the receive buffer, it has
56/// to be specified here to make sure the window scale option is set (for
57/// tcpwindowsize > 65KB and for platforms supporting window scaling).
58/// Returns when connection has been accepted by remote side. Use IsValid()
59/// to check the validity of the socket. Every socket is added to the TROOT
60/// sockets list which will make sure that any open sockets are properly
61/// closed on program termination.
62
69
70////////////////////////////////////////////////////////////////////////////////
71/// Create a parallel socket. Connect to named service on the remote host.
72/// Use tcpwindowsize to specify the size of the receive buffer, it has
73/// to be specified here to make sure the window scale option is set (for
74/// tcpwindowsize > 65KB and for platforms supporting window scaling).
75/// Returns when connection has been accepted by remote side. Use IsValid()
76/// to check the validity of the socket. Every socket is added to the TROOT
77/// sockets list which will make sure that any open sockets are properly
78/// closed on program termination.
79
80TPSocket::TPSocket(const char *host, const char *service, Int_t size,
82{
83 fSize = size;
85}
86
87////////////////////////////////////////////////////////////////////////////////
88/// Create a parallel socket. Connect to specified port # on the remote host.
89/// Use tcpwindowsize to specify the size of the receive buffer, it has
90/// to be specified here to make sure the window scale option is set (for
91/// tcpwindowsize > 65KB and for platforms supporting window scaling).
92/// Returns when connection has been accepted by remote side. Use IsValid()
93/// to check the validity of the socket. Every socket is added to the TROOT
94/// sockets list which will make sure that any open sockets are properly
95/// closed on program termination.
96
97TPSocket::TPSocket(const char *host, Int_t port, Int_t size,
99 : TSocket(host, port, (Int_t)(size > 1 ? -1 : tcpwindowsize))
100{
101 // set to the real value only at end (except for old servers)
102 fSize = 1;
103
104 // to control the flow
106
107 // check if we are called from CreateAuthSocket()
109 char *pauth = (char *)strstr(host, "?A");
110 if (pauth) {
111 authreq = kTRUE;
112 }
113
114 // perhaps we can use fServType here ... to be checked
115 Bool_t rootdSrv = (strstr(host,"rootd")) ? kTRUE : kFALSE;
116
117 // try authentication , if required
118 if (authreq) {
119 if (valid) {
120 if (!Authenticate(TUrl(host).GetUser())) {
121 if (rootdSrv && (fRemoteProtocol > 0 && fRemoteProtocol < 10)) {
122 // We failed because we are talking to an old
123 // server: we need to re-open the connection
124 // and communicate the size first
125 Int_t tcpw = (size > 1 ? -1 : tcpwindowsize);
126 TSocket *ns = new TSocket(host, port, tcpw);
127 if (ns->IsValid()) {
129 gROOT->GetListOfSockets()->Remove(ns);
130 fSocket = ns->GetDescriptor();
131 fSize = size;
133 }
134 if ((valid = IsValid())) {
135 if (!Authenticate(TUrl(host).GetUser())) {
137 valid = kFALSE;
138 }
139 }
140 } else {
142 valid = kFALSE;
143 }
144 }
145 }
146 // reset url to the original state
147 *pauth = '\0';
148 SetUrl(host);
149 }
150
151 // open the sockets ...
152 if (!rootdSrv || fRemoteProtocol > 9) {
153 if (valid) {
154 fSize = size;
156 }
157 }
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Create a parallel socket on a connection already opened via
162/// TSocket sock.
163/// This constructor is provided to optimize TNetFile opening when
164/// instatiated via a call to TNetXNGFile.
165/// Returns when connection has been accepted by remote side. Use IsValid()
166/// to check the validity of the socket. Every socket is added to the TROOT
167/// sockets list which will make sure that any open sockets are properly
168/// closed on program termination.
169
170TPSocket::TPSocket(const char *host, Int_t port, Int_t size, TSocket *sock)
171{
172 // To avoid uninitialization problems when Init is not called ...
173 fSockets = 0;
174 fWriteMonitor = 0;
175 fReadMonitor = 0;
176 fWriteBytesLeft = 0;
177 fReadBytesLeft = 0;
178 fWritePtr = 0;
179 fReadPtr = 0;
180
181 // set to the real value only at end (except for old servers)
182 fSize = 1;
183
184 // We need a opened connection
185 if (!sock) return;
186
187 // Now import existing socket info
188 fSocket = sock->GetDescriptor();
189 fService = sock->GetService();
190 fAddress = sock->GetInetAddress();
192 fBytesSent = sock->GetBytesSent();
193 fBytesRecv = sock->GetBytesRecv();
195 fSecContext = sock->GetSecContext();
199
200 // to control the flow
201 Bool_t valid = sock->IsValid();
202
203 // check if we are called from CreateAuthSocket()
205 char *pauth = (char *)strstr(host, "?A");
206 if (pauth) {
207 authreq = kTRUE;
208 }
209
210 // perhaps we can use fServType here ... to be checked
211 Bool_t rootdSrv = (strstr(host,"rootd")) ? kTRUE : kFALSE;
212
213 // try authentication , if required
214 if (authreq) {
215 if (valid) {
216 if (!Authenticate(TUrl(host).GetUser())) {
217 if (rootdSrv && (fRemoteProtocol > 0 && fRemoteProtocol < 10)) {
218 // We failed because we are talking to an old
219 // server: we need to re-open the connection
220 // and communicate the size first
221 Int_t tcpw = (size > 1 ? -1 : fTcpWindowSize);
222 TSocket *ns = new TSocket(host, port, tcpw);
223 if (ns->IsValid()) {
225 gROOT->GetListOfSockets()->Remove(ns);
226 fSocket = ns->GetDescriptor();
227 fSize = size;
229 }
230 if ((valid = IsValid())) {
231 if (!Authenticate(TUrl(host).GetUser())) {
233 valid = kFALSE;
234 }
235 }
236 } else {
238 valid = kFALSE;
239 }
240 }
241 }
242 // reset url to the original state
243 *pauth = '\0';
244 SetUrl(host);
245 }
246
247 // open the sockets ...
248 if (!rootdSrv || fRemoteProtocol > 9) {
249 if (valid) {
250 fSize = size;
251 Init(fTcpWindowSize, sock);
252 }
253 }
254
255 // Add to the list if everything OK
256 if (IsValid()) {
258 gROOT->GetListOfSockets()->Add(this);
259 }
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Create a parallel socket. This ctor is called by TPServerSocket.
264
266{
268 fSize = size;
269
270 // set descriptor if simple socket (needed when created
271 // by TPServerSocket)
272 if (fSize <= 1)
274
275 // set socket options (no blocking and no delay)
277 if (fSize > 1)
279
284 fWritePtr = new char*[fSize];
285 fReadPtr = new char*[fSize];
286
287 for (int i = 0; i < fSize; i++) {
290 }
293
294 SetName(fSockets[0]->GetName());
297
298 {
300 gROOT->GetListOfSockets()->Add(this);
301 }
302}
303
304////////////////////////////////////////////////////////////////////////////////
305/// Cleanup the parallel socket.
306
308{
309 Close();
310
311 delete fWriteMonitor;
312 delete fReadMonitor;
313 delete [] fWriteBytesLeft;
314 delete [] fReadBytesLeft;
315 delete [] fWritePtr;
316 delete [] fReadPtr;
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Close a parallel socket. If option is "force", calls shutdown(id,2) to
321/// shut down the connection. This will close the connection also
322/// for the parent of this process. Also called via the dtor (without
323/// option "force", call explicitly Close("force") if this is desired).
324
326{
327
328 if (!IsValid()) {
329 // if closing happens too early (e.g. timeout) the underlying
330 // socket may still be open
332 return;
333 }
334
335 if (fSize <= 1) {
337 } else {
338 for (int i = 0; i < fSize; i++) {
339 fSockets[i]->Close(option);
340 delete fSockets[i];
341 }
342 }
343 delete [] fSockets;
344 fSockets = 0;
345
346 {
348 gROOT->GetListOfSockets()->Remove(this);
349 }
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Create a parallel socket to the specified host.
354
356{
357 fSockets = 0;
358 fWriteMonitor = 0;
359 fReadMonitor = 0;
360 fWriteBytesLeft = 0;
361 fReadBytesLeft = 0;
362 fWritePtr = 0;
363 fReadPtr = 0;
364
365 if ((sock && !sock->IsValid()) || !TSocket::IsValid())
366 return;
367
368 Int_t i = 0;
369
370 if (fSize <= 1) {
371 // check if single mode
372 fSize = 1;
373
374 // set socket options (no delay)
375 if (sock)
376 sock->SetOption(kNoDelay, 1);
377 else
379
380 // if yes, communicate this to server
381 // (size = 0 for backward compatibility)
382 if (sock) {
383 if (sock->Send((Int_t)0, (Int_t)0) < 0)
384 Warning("Init", "%p: problems sending (0,0)", sock);
385 } else {
386 if (TSocket::Send((Int_t)0, (Int_t)0) < 0)
387 Warning("Init", "problems sending (0,0)");
388 }
389
390 // needs to fill additional private members
391 fSockets = new TSocket*[1];
392 fSockets[0]= (TSocket *)this;
393
394 } else {
395
396 // create server that will be used to accept the parallel sockets from
397 // the remote host, use port=0 to scan for a free port
399
400 // send the local port number of the just created server socket and the
401 // number of desired parallel sockets
402 if (sock) {
403 if (sock->Send(ss.GetLocalPort(), fSize) < 0)
404 Warning("Init", "%p: problems sending size", sock);
405 } else {
406 if (TSocket::Send(ss.GetLocalPort(), fSize) < 0)
407 Warning("Init", "problems sending size");
408 }
409
410 fSockets = new TSocket*[fSize];
411
412 // establish fSize parallel socket connections between client and server
413 for (i = 0; i < fSize; i++) {
414 fSockets[i] = ss.Accept();
416 gROOT->GetListOfSockets()->Remove(fSockets[i]);
417 }
418
419 // set socket options (no blocking and no delay)
422
423 // close original socket
424 if (sock)
425 sock->Close();
426 else
428 fSocket = -1;
429 }
430
435 fWritePtr = new char*[fSize];
436 fReadPtr = new char*[fSize];
437
438 for (i = 0; i < fSize; i++) {
441 }
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Return internet address of local host to which the socket is bound.
448/// In case of error TInetAddress::IsValid() returns kFALSE.
449
451{
452 if (fSize<= 1)
454
455 if (IsValid()) {
456 if (fLocalAddress.GetPort() == -1)
458 return fLocalAddress;
459 }
460 return TInetAddress();
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// Return socket descriptor
465
467{
468 if (fSize <= 1)
469 return TSocket::GetDescriptor();
470
471 return fSockets ? fSockets[0]->GetDescriptor() : -1;
472
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Send a TMessage object. Returns the number of bytes in the TMessage
477/// that were sent and -1 in case of error. In case the TMessage::What
478/// has been or'ed with kMESS_ACK, the call will only return after having
479/// received an acknowledgement, making the sending process synchronous.
480/// Returns -4 in case of kNoBlock and errno == EWOULDBLOCK.
481
483{
484 if (!fSockets || fSize <= 1)
485 return TSocket::Send(mess); // only the case when called via Init()
486
487 if (!IsValid()) {
488 return -1;
489 }
490
491 if (mess.IsReading()) {
492 Error("Send", "cannot send a message used for reading");
493 return -1;
494 }
495
496 // send streamer infos in case schema evolution is enabled in the TMessage
498
499 // send the process id's so TRefs work
501
502 mess.SetLength(); //write length in first word of buffer
503
504 if (GetCompressionLevel() > 0 && mess.GetCompressionLevel() == 0)
506
507 if (mess.GetCompressionLevel() > 0)
508 const_cast<TMessage&>(mess).Compress();
509
510 char *mbuf = mess.Buffer();
511 Int_t mlen = mess.Length();
512 if (mess.CompBuffer()) {
513 mbuf = mess.CompBuffer();
514 mlen = mess.CompLength();
515 }
516
517 Int_t nsent, ulen = (Int_t) sizeof(UInt_t);
518 // send length
519 if ((nsent = SendRaw(mbuf, ulen, kDefault)) <= 0)
520 return nsent;
521
522 // send buffer (this might go in parallel)
523 if ((nsent = SendRaw(mbuf+ulen, mlen-ulen, kDefault)) <= 0)
524 return nsent;
525
526 // if acknowledgement is desired, wait for it
527 if (mess.What() & kMESS_ACK) {
528 char buf[2];
529 if (RecvRaw(buf, sizeof(buf), kDefault) < 0)
530 return -1;
531 if (strncmp(buf, "ok", 2)) {
532 Error("Send", "bad acknowledgement");
533 return -1;
534 }
535 }
536
537 return nsent; //length - length header
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Send a raw buffer of specified length. Returns the number of bytes
542/// send and -1 in case of error.
543
545{
546 if (fSize == 1)
547 return TSocket::SendRaw(buffer,length,opt);
548
549 if (!fSockets) return -1;
550
551 // if data buffer size < 4K use only one socket
552 Int_t i, nsocks = fSize, len = length;
553 if (len < 4096)
554 nsocks = 1;
555
557 if (nsocks == 1)
559
560 if (opt != kDefault) {
561 nsocks = 1;
562 sendopt = opt;
563 }
564
565 if (nsocks == 1)
567 else
569
570 // setup pointer appropriately for transferring data equally on the
571 // parallel sockets
572 for (i = 0; i < nsocks; i++) {
574 fWritePtr[i] = (char *)buffer + (i*fWriteBytesLeft[i]);
576 }
578
579 // send the data on the parallel sockets
580 while (len > 0) {
582 for (int is = 0; is < nsocks; is++) {
583 if (s == fSockets[is]) {
584 if (fWriteBytesLeft[is] > 0) {
585 Int_t nsent;
586again:
590 sendopt)) <= 0) {
591 if (nsent == -4) {
592 // got EAGAIN/EWOULDBLOCK error, keep trying...
593 goto again;
594 }
596 if (nsent == -5) {
597 // connection reset by peer or broken ...
599 Close();
600 }
601 return -1;
602 }
603 if (opt == kDontBlock) {
605 return nsent;
606 }
608 fWritePtr[is] += nsent;
609 len -= nsent;
610 }
611 }
612 }
613 }
615
616 return length;
617}
618
619////////////////////////////////////////////////////////////////////////////////
620/// Receive a TMessage object. The user must delete the TMessage object.
621/// Returns length of message in bytes (can be 0 if other side of connection
622/// is closed) or -1 in case of error or -4 in case a non-blocking socket would
623/// block (i.e. there is nothing to be read). In those case mess == 0.
624
626{
627 if (fSize <= 1)
628 return TSocket::Recv(mess);
629
630 if (!IsValid()) {
631 mess = 0;
632 return -1;
633 }
634
636 Int_t n;
637 UInt_t len;
638 if ((n = RecvRaw(&len, sizeof(UInt_t), kDefault)) <= 0) {
639 mess = 0;
640 return n;
641 }
642 len = net2host(len); //from network to host byte order
643
644 char *buf = new char[len+sizeof(UInt_t)];
645 if ((n = RecvRaw(buf+sizeof(UInt_t), len, kDefault)) <= 0) {
646 delete [] buf;
647 mess = 0;
648 return n;
649 }
650
651 mess = new TMessage(buf, len+sizeof(UInt_t));
652
653 // receive any streamer infos
655 goto oncemore;
656
657 // receive any process ids
658 if (RecvProcessIDs(mess))
659 goto oncemore;
660
661 if (mess->What() & kMESS_ACK) {
662 char ok[2] = { 'o', 'k' };
663 if (SendRaw(ok, sizeof(ok), kDefault) < 0) {
664 delete mess;
665 mess = 0;
666 return -1;
667 }
668 mess->SetWhat(mess->What() & ~kMESS_ACK);
669 }
670
671 return n;
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Send a raw buffer of specified length. Returns the number of bytes
676/// sent or -1 in case of error.
677
679{
680 if (fSize <= 1)
681 return TSocket::RecvRaw(buffer,length,opt);
682
683 if (!fSockets) return -1;
684
685 // if data buffer size < 4K use only one socket
686 Int_t i, nsocks = fSize, len = length;
687 if (len < 4096)
688 nsocks = 1;
689
691 if (nsocks == 1)
693
694 if (opt != kDefault) {
695 nsocks = 1;
696 recvopt = opt;
697 }
698
699 if (nsocks == 1)
701 else
703
704 // setup pointer appropriately for transferring data equally on the
705 // parallel sockets
706 for (i = 0; i < nsocks; i++) {
708 fReadPtr[i] = (char *)buffer + (i*fReadBytesLeft[i]);
710 }
712
713 // start receiving data on all sockets. Receive data as and when
714 // they are available on a socket by by using select.
715 // Exit the loop as soon as all data has been received.
716 while (len > 0) {
718 for (int is = 0; is < nsocks; is++) {
719 if (s == fSockets[is]) {
720 if (fReadBytesLeft[is] > 0) {
721 Int_t nrecv;
725 recvopt)) <= 0) {
727 if (nrecv == -5) {
728 // connection reset by peer or broken ...
730 Close();
731 }
732 return -1;
733 }
734 if (opt == kDontBlock) {
736 return nrecv;
737 }
739 fReadPtr[is] += nrecv;
740 len -= nrecv;
741 }
742 }
743 }
744 }
746
747 return length;
748}
749
750////////////////////////////////////////////////////////////////////////////////
751/// Set socket options.
752
754{
755 if (fSize <= 1)
756 return TSocket::SetOption(opt,val);
757
758 Int_t ret = 0;
759 for (int i = 0; i < fSize; i++)
760 ret = fSockets[i]->SetOption(opt, val);
761 return ret;
762}
763
764////////////////////////////////////////////////////////////////////////////////
765/// Get socket options. Returns -1 in case of error.
766
768{
769 if (fSize <= 1)
770 return TSocket::GetOption(opt,val);
771
772 Int_t ret = 0;
773 for (int i = 0; i < fSize; i++)
774 ret = fSockets[i]->GetOption(opt, val);
775 return ret;
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Returns error code. Meaning depends on context where it is called.
780/// If no error condition returns 0 else a value < 0.
781
783{
784 if (fSize <= 1)
785 return TSocket::GetErrorCode();
786
787 return fSockets[0] ? fSockets[0]->GetErrorCode() : 0;
788}
UShort_t net2host(UShort_t x)
Definition Bytes.h:575
@ kMESS_ACK
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
R__EXTERN TVirtualMutex * gROOTMutex
Definition TROOT.h:63
#define gROOT
Definition TROOT.h:411
ESockOptions
Definition TSystem.h:229
@ kNoBlock
Definition TSystem.h:236
@ kNoDelay
Definition TSystem.h:235
ESendRecvOptions
Definition TSystem.h:242
@ kDontBlock
Definition TSystem.h:246
@ kDefault
Definition TSystem.h:243
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define R__LOCKGUARD(mutex)
This class represents an Internet Protocol (IP) address.
Int_t GetPort() const
Int_t Compress()
Compress the message.
Definition TMessage.cxx:318
TSocket * Select()
Return pointer to socket for which an event is waiting.
Definition TMonitor.cxx:321
virtual void Activate(TSocket *sock)
Activate a de-activated socket.
Definition TMonitor.cxx:249
virtual void Add(TSocket *sock, Int_t interest=kRead)
Add socket to the monitor's active list.
Definition TMonitor.cxx:167
virtual void DeActivateAll()
De-activate all activated sockets.
Definition TMonitor.cxx:301
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
void ResetBit(UInt_t f)
Definition TObject.h:201
Int_t Send(const TMessage &mess) override
Send a TMessage object.
Definition TPSocket.cxx:482
Int_t Recv(TMessage *&mess) override
Receive a TMessage object.
Definition TPSocket.cxx:625
TPSocket(TSocket *pSockets[], Int_t size)
Create a parallel socket. This ctor is called by TPServerSocket.
Definition TPSocket.cxx:265
Int_t fSize
Definition TPSocket.h:41
char ** fReadPtr
Definition TPSocket.h:45
TMonitor * fWriteMonitor
Definition TPSocket.h:39
void Close(Option_t *opt="") override
Close a parallel socket.
Definition TPSocket.cxx:325
virtual ~TPSocket()
Cleanup the parallel socket.
Definition TPSocket.cxx:307
void Init(Int_t tcpwindowsize, TSocket *sock=nullptr)
Create a parallel socket to the specified host.
Definition TPSocket.cxx:355
TMonitor * fReadMonitor
Definition TPSocket.h:40
Int_t GetErrorCode() const
Returns error code.
Definition TPSocket.cxx:782
Int_t SetOption(ESockOptions opt, Int_t val) override
Set socket options.
Definition TPSocket.cxx:753
TInetAddress GetLocalInetAddress() override
Return internet address of local host to which the socket is bound.
Definition TPSocket.cxx:450
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault) override
Send a raw buffer of specified length.
Definition TPSocket.cxx:678
char ** fWritePtr
Definition TPSocket.h:44
Option_t * GetOption() const override
Definition TPSocket.h:51
Int_t * fWriteBytesLeft
Definition TPSocket.h:42
Int_t * fReadBytesLeft
Definition TPSocket.h:43
Int_t GetDescriptor() const override
Return socket descriptor.
Definition TPSocket.cxx:466
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault) override
Send a raw buffer of specified length.
Definition TPSocket.cxx:544
Bool_t IsValid() const override
Definition TPSocket.h:79
TSocket ** fSockets
Definition TPSocket.h:38
TInetAddress fAddress
Definition TSocket.h:57
Int_t fCompress
Definition TSocket.h:60
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
Definition TSocket.cxx:1004
Int_t fSocket
Definition TSocket.h:67
Int_t GetErrorCode() const
Returns error code.
Definition TSocket.cxx:1026
UInt_t GetBytesRecv() const
Definition TSocket.h:118
void SendStreamerInfos(const TMessage &mess)
Check if TStreamerInfo must be sent.
Definition TSocket.cxx:640
const char * GetService() const
Definition TSocket.h:114
TSocket()
Definition TSocket.h:81
TString fService
Definition TSocket.h:65
Bool_t RecvStreamerInfos(TMessage *mess)
Receive a message containing streamer infos.
Definition TSocket.cxx:919
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition TSocket.cxx:809
Int_t GetRemoteProtocol() const
Definition TSocket.h:124
UInt_t GetBytesSent() const
Definition TSocket.h:117
Bool_t Authenticate(const char *user)
Authenticated the socket with specified user.
Definition TSocket.cxx:1097
TInetAddress fLocalAddress
Definition TSocket.h:61
Int_t GetTcpWindowSize() const
Definition TSocket.h:126
@ kBrokenConn
Definition TSocket.h:47
virtual void Close(Option_t *opt="")
Close the socket.
Definition TSocket.cxx:380
Bool_t RecvProcessIDs(TMessage *mess)
Receive a message containing process ids.
Definition TSocket.cxx:966
void SetUrl(const char *url)
Definition TSocket.h:153
TInetAddress GetInetAddress() const
Definition TSocket.h:111
Int_t GetCompressionLevel() const
Definition TSocket.h:179
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
Definition TSocket.cxx:889
TSecContext * GetSecContext() const
Definition TSocket.h:125
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
Definition TSocket.cxx:611
void SendProcessIDs(const TMessage &mess)
Check if TProcessIDs must be sent.
Definition TSocket.cxx:675
virtual TInetAddress GetLocalInetAddress()
Return internet address of local host to which the socket is bound.
Definition TSocket.cxx:400
TSecContext * fSecContext
Definition TSocket.h:63
Int_t fTcpWindowSize
Definition TSocket.h:68
Option_t * GetOption() const override
Definition TSocket.h:96
EServiceType
Definition TSocket.h:50
virtual Int_t GetDescriptor() const
Definition TSocket.h:110
Int_t GetCompressionSettings() const
Definition TSocket.h:185
Int_t GetServType() const
Definition TSocket.h:115
EServiceType fServType
Definition TSocket.h:66
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm: settings = 100 * algorithm + level.
Definition TSocket.cxx:1089
UInt_t fBytesSent
Definition TSocket.h:59
Int_t fRemoteProtocol
Definition TSocket.h:62
UInt_t fBytesRecv
Definition TSocket.h:58
virtual Bool_t IsValid() const
Definition TSocket.h:130
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition TSocket.cxx:513
virtual TInetAddress GetSockName(int sock)
Get Internet Protocol (IP) address of host and port #.
Definition TSystem.cxx:2320
virtual void CloseConnection(int sock, Bool_t force=kFALSE)
Close socket connection.
Definition TSystem.cxx:2401
This class represents a WWW compatible URL.
Definition TUrl.h:33
const Int_t n
Definition legend1.C:16