[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Polling socket_t instead of ssh_socket
[Thread Prev] | [Thread Next]
- Subject: Polling socket_t instead of ssh_socket
- From: Joao Pedro Almeida Pereira <joao.almeida@xxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 9 Jul 2014 16:33:09 +0200
- To: libssh <libssh@xxxxxxxxxx>
Hello, I am looking into one issue i have with the libssh. The problem i have is that the connect returns -1 with errno 115, basically the resource is not ready yet. So to solve this i added a select there to wait for the socket to be ready, something like: do{ rc = connect(s, itr->ai_addr, itr->ai_addrlen); SSH_LOG(SSH_LOG_PACKET, "rc: '%d' errno: '%d' on socket: %d", rc, errno, s); if(rc == -1 && errno ==EINPROGRESS ){ FD_ZERO(&socks); timeout.tv_sec = 1; timeout.tv_usec = 0; int readsocks = select(s+1, &socks, (fd_set *) 0, (fd_set *) 0, &timeout); }else break; }while(1); #connect.c: ssh_connect_host_nonblocking And this solves the issue, but from looking at the rest of the code i can see that there is no select and everything is done via the poll module. My question is can i use this module to poll the socket_t or this should be done in a different way? BR -- ----- -------- João Pereira Email: joao.almeida@xxxxxxxxxxx Web: http://www.bluetc.es
Archive administrator: postmaster@lists.cynapses.org