Socket connection return "Process file table overflow."



Hi,

I'm trying to implement a HTTPS file downloader in Linux with c++. But
I've got two problems that are:

1) I can't perform two sequential downloads with the same open
socket, the SSL_write and SSL_read functions fail in the second
download.
2) Because of the first problem, before i download any file i perform
a reconnect action (close the connection and open again everything),
but the problem is that when i try to download several files (300 for
example), sequentially, in the 20s or 30s i have the following error
"Process file table overflow." when i try to create the socket. And
only after waiting a while (five ten minutes) is when i can download
any other file without restarting the process.

I' think that my problem to both problems is cleaning process, i do
not close or is missing some cleanup operations on my socket... but i
can't seem to figure what is?!

For example to connect i perform the following actions:
//open the socket
m_nSocketFD = socket(PF_INET, SOCK_STREAM, 0); /*is here that the
"Process file table overflow." is given*/
bzero(&sAddr, sizeof(sAddr));
sAddr.sin_family = AF_INET;
sAddr.sin_port = htons(n_port);
sAddr.sin_addr.s_addr = *(long*)(psHost->h_addr);
connect(m_nSocketFD, (struct sockaddr*)&sAddr, sizeof(sAddr));
//open the ssl connection
m_psSSLctx = InitCTX();
m_psSSL = SSL_new(m_psSSLctx); /* create new SSL connection state
*/
SSL_set_connect_state(m_psSSL);
SSL_set_fd(m_psSSL, m_nSocketFD); /* attach the socket descriptor
*/
SSL_set_mode(m_psSSL,SSL_MODE_AUTO_RETRY);
SSL_connect(m_psSSL);


To close connections i perform the following actions (i think it's
here that is missing something but i don't know what?!?)
X509_free(m_pcX509Cert);
SSL_shutdown(m_psSSL);
SSL_free(m_psSSL);
SSL_CTX_free(m_psSSLctx);

close(m_nSocketFD);/* close socket */


Thanks for the attention
Nuno
.



Relevant Pages

  • Re: RPGIV Socket Help
    ... socket that uses the POST as opposed to GET? ... Look up the HTTP specs and see how a post should look. ... I want to connect to one of our vendors web services, ... and download a formatted text file to the IFS. ...
    (comp.sys.ibm.as400.misc)
  • Re: USB ADSL Modem query
    ... Or does the Laptop use its own WiFi Adaptor? ... Even with the Router Plugged into an Extension Socket, ... If you still get the poor/dropped Connections & poor Download Speeds ...
    (uk.people.silversurfers)
  • Socket connection return "Process file table overflow."
    ... I can't perform two sequential downloads with the same open ... Because of the first problem, before i download any file i perform ... a reconnect action (close the connection and open again everything), ... when i try to create the socket. ...
    (comp.os.linux.development.apps)
  • Re: Socket connection return "Process file table overflow."
    ... where i can't seem to understand, I'm freeing the context because the ... but the problem is that when i try to download several files (300 for ... when i try to create the socket. ... connections properly. ...
    (comp.os.linux.development.system)
  • Re: Socket connection return "Process file table overflow."
    ... a reconnect action (close the connection and open again everything), ... but the problem is that when i try to download several files (300 for ... when i try to create the socket. ... not close or is missing some cleanup operations on my socket... ...
    (comp.os.linux.development.system)