TcpClient Server = new TcpClient(_sPOP3Server, 25); Stream NetStrm = Server.GetStream(); StreamReader RdStrm = new StreamReader(Server.GetStream()); string s = RdStrm.ReadLine();and it hangs on the ReadLine.
>>/*************************************************************** >> * 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; >> } >> >>} >>>
> >using (StreamReader sr = new StreamReader(oStream)) >{ > while (sr.Peek() >= 0) > { > sResponse = sr.ReadLine()); > if (! string.IsNullOrEmpty(sResponse)) > { > do ssomething here.... > } > } >} > >