Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# - Code Freezes Up
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
C# - Code Freezes Up
Miscellaneous
Thread ID:
01283306
Message ID:
01283306
Views:
59
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
Next
Reply
Map
View

Click here to load this message in the networking platform