00001 #ifndef __XRDNETCONNECT__ 00002 #define __XRDNETCONNECT__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d N e t C o n n e c t . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdNetConnect.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 #include <sys/types.h> 00016 #ifndef WIN32 00017 #include <sys/socket.h> 00018 #else 00019 #include <Winsock2.h> 00020 #endif 00021 00022 class XrdNetConnect 00023 { 00024 public: 00025 00026 // Connect() performs the same function as sycall connect() however, it 00027 // can optionally apply a thread-safe timeout of tsec seconds. 00028 // It returns 0 upon success or errno upon failure. 00029 // 00030 static int Connect( int fd, // Open socket descriptor 00031 const struct sockaddr *name, // Address to connect to 00032 int namelen, // Size of address 00033 int tsec=-1);// Optional timeout 00034 00035 private: 00036 // Only this class is allowed to create and delete this object 00037 // 00038 XrdNetConnect() {} 00039 ~XrdNetConnect() {} 00040 }; 00041 #endif