2

さて、私は安っぽいリグで修正したと思っていた問題に遭遇し、長期的には失敗したので、皆さんに正しい方法を尋ねるようになりました. ここに私が抱えている問題があります.POP3経由で(ActiveUp APIを使用して)特定の種類の電子メールを除外するアプリケーションを作成していますが、POP3サーバーへの常時接続が必要です...これが私が持っているものですたった今:

public static void Main (string[] args) 
    {
        while(true)
        {           
            POP3();
            Console.Title = "Waiting for "+GetSubject+POST;
            Thread.Sleep(5000);
        }
    }
    public static void POP3()
    {
        Pop3Client pop3 = new Pop3Client();
        try
        {
            pop3.ConnectSsl("pop.gmail.com",995,"", "");
            if(pop3.MessageCount > 0)
            {
                int CurrentMessage = pop3.MessageCount;
                ActiveUp.Net.Mail.Message message = pop3.RetrieveMessageObject(CurrentMessage);
                if(message.Subject == GetSubject+POST)
                {
                Console.WriteLine("command reconized from {0}: {1}\n Sending responce now!",message.From.Email, message.Subject);
                SMTP (message.From.Email, _message);
                POST++;
                pop3.Close();
                }
            }
            else
            {
                Console.WriteLine("no mail found"); 
            }
        }
        catch(Pop3Exception iex)
        {
            Console.WriteLine(iex); 
            pop3.Close();
        }
    }

約 10 ~ 20 分実行するまで、すべてが完璧に機能します。Google の POP3 サーバーから追い出され、アプリケーションを再起動する必要があります...今すぐアプリケーションを実行し、エラーで質問を再編集します...しかし、それまでは皆さん私を助けてください?ありがとう!

エラー:

nhandled Exception: System.Net.Sockets.SocketException: No such host is known
  at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostAddresses (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.TcpClient.Connect (System.String hostname, Int32 port) [0x00000] in <filename unknown>:0 
  at ActiveUp.Net.Mail.Pop3Client.ConnectSsl (System.String host, Int32 port, System.String user, System.String pass, ActiveUp.Net.Security.SslHandShake sslHandShake) [0x00000] in <filename unknown>:0 
  at ActiveUp.Net.Mail.Pop3Client.ConnectSsl (System.String host, Int32 port, System.String user, System.String pass) [0x00000] in <filename unknown>:0 
  at AutoThreadOwnerCopy.MainClass.POP3 () [0x00006] in /home/m44m31/AutoThreadOwnerCopy/AutoThreadOwnerCopy/Main.cs:35 
  at AutoThreadOwnerCopy.MainClass.Main (System.String[] args) [0x00019] in /home/m44m31/AutoThreadOwnerCopy/AutoThreadOwnerCopy/Main.cs:25 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Net.Sockets.SocketException: No such host is known
  at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 
  at System.Net.Dns.GetHostAddresses (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.TcpClient.Connect (System.String hostname, Int32 port) [0x00000] in <filename unknown>:0 
  at ActiveUp.Net.Mail.Pop3Client.ConnectSsl (System.String host, Int32 port, System.String user, System.String pass, ActiveUp.Net.Security.SslHandShake sslHandShake) [0x00000] in <filename unknown>:0 
  at ActiveUp.Net.Mail.Pop3Client.ConnectSsl (System.String host, Int32 port, System.String user, System.String pass) [0x00000] in <filename unknown>:0 
  at AutoThreadOwnerCopy.MainClass.POP3 () [0x00006] in /home/m44m31/AutoThreadOwnerCopy/AutoThreadOwnerCopy/Main.cs:35 
  at AutoThreadOwnerCopy.MainClass.Main (System.String[] args) [0x00019] in /home/m44m31/AutoThreadOwnerCopy/AutoThreadOwnerCopy/Main.cs:25 
4

0 に答える 0