Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# - Code Freezes Up
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
C# - Code Freezes Up
Divers
Thread ID:
01283306
Message ID:
01283306
Vues:
61
I'm writing a little C# app that connects to a POP3 mailbox and checks for mail.
The code freezes with a console window open at the indicated line.

This is an adaption of the code found here http://www.codeproject.com/KB/IP/popapp.aspx

Anyone know what's going on?
/***************************************************************
 * This is the test console app
 ***************************************************************/
static void Main(string[] args)
{
    int i = 0;

    XMail.XMail oMail = new XMail.XMail();

    oMail.sPOP3Server = "incoming.verizon.net";
    oMail.iPort = 25;

    oMail.Connect("myusername", "mypassword");

}
/***************************************************************
 * This is the class
 ***************************************************************/
public class XMail
{

    private string _sPOP3Server;
    private int _iPort;
    private TcpClient oServer = null;
    private Stream oStream = null;
    private StreamReader oReader = null;


    public bool Connect(string sLoginName, string sPassword)
    {
        bool bRetVal = false;
        string sResponse;

        oServer = new TcpClient(_sPOP3Server, _iPort);

        oStream = oServer.GetStream();

        oReader = new StreamReader(oServer.GetStream());
        
        sResponse = oReader.ReadLine();       <== FREEZES ON THIS LINE

        // More code to follow here:

        return bRetVal;
    }

}
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform