#include <XrdNetConnect.hh>
|
static int | Connect (int fd, const struct sockaddr *name, int namelen, int tsec=-1) |
|
Definition at line 40 of file XrdNetConnect.hh.
◆ Connect()
int XrdNetConnect::Connect |
( |
int |
fd, |
|
|
const struct sockaddr * |
name, |
|
|
int |
namelen, |
|
|
int |
tsec = -1 |
|
) |
| |
|
static |
Definition at line 47 of file XrdNetConnect.cc.
52 int old_flags, new_flags, myRC;
59 {
if (connect(fd, name, namelen))
return errno;
68 old_flags =
fcntl(fd, F_GETFL, 0);
69 new_flags = old_flags | O_NDELAY | O_NONBLOCK;
70 fcntl(fd, F_SETFL, new_flags);
71 if (!connect(fd, name, namelen)) myRC = 0;
73 else {
struct pollfd polltab = {fd, POLLOUT|POLLWRNORM, 0};
74 do {myRC = poll(&polltab, 1, tsec*1000);}
75 while(myRC < 0 && errno == EINTR);
76 if (myRC != 1) myRC = ETIMEDOUT;
77 else getsockopt(fd,SOL_SOCKET,SO_ERROR,(
Sokdata_t)&myRC,&myRClen);
79 fcntl(fd, F_SETFD, old_flags);
int fcntl(int fd, int cmd,...)
References fcntl(), net_errno, SOCKLEN_t, and Sokdata_t.
Referenced by XrdCl::Socket::ConnectToAddress(), and XrdNetSocket::Open().
The documentation for this class was generated from the following files: