问题
I am trying to send an email from a C++ program using imap library. I have a Google Apps and a Gmail account to which I am sending the email.
Whenever the program fails to send an email I am logging the errors to a file.
I set my program to run in loop to send the emails. Sometimes, I don't get the emails and when I checked the log file I found out these errors being logged every time sending the email fails.
Here is the part of the log file:
[2012-04-23 11:04:34] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (2753 >= 1024)
[2012-04-23 11:04:34] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (2753 >= 1024)
[2012-04-23 11:05:36] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1692 >= 1024)
[2012-04-23 11:05:36] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1692 >= 1024)
[2012-04-23 11:07:52] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1605 >= 1024)
[2012-04-23 11:07:52] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1605 >= 1024)
[2012-04-23 11:08:02] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1566 >= 1024)
[2012-04-23 11:08:02] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1566 >= 1024)
[2012-04-23 11:08:09] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1067 >= 1024)
[2012-04-23 11:08:09] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1067 >= 1024)
[2012-04-23 11:08:19] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1648 >= 1024)
[2012-04-23 11:08:19] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1648 >= 1024)
[2012-04-23 11:08:20] ErrCode:1 ErrMsg:Unable to create selectable TCP socket (1130 >= 1024)
[2012-04-23 11:08:20] ErrCode:2 ErrMsg:Unable to create selectable TCP socket (1130 >= 1024)
Is it related to imap server port? If so, which port should it be set to? 993 always?? How to troubleshoot this error?
Here are my setting:
Name: Ashwin
my email: blahblah@wyswtf.com
reply-to-email: blahblah@wyswtf.com
SMTP server information:
Host: smtp.gmail.com
Encryption: SSL
Port: 465
The program runs as root user and the library that I am using is from http://panda.com/imap/
回答1:
The library uses some ancient I/O multiplexing code and as a result it can only handle 1,024 connections at a time. Either use a different library or rate-limit your requests to the library.
Update: I was going to research this for you and, if necessary, fix the code to work around this or figure out changes to how you build the code. But it seems the library is not publicly available. Sorry, we can't fix closed source code for you.
来源:https://stackoverflow.com/questions/10310712/imap-unable-to-create-selectable-tcp-socket-when-sending-email-from-a-c-pro