>/*************************************************************** > * 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; > } > >} >Acouple of things jump out right away, not sure if they could cause your problem or not...
using (StreamReader sr = new StreamReader(oStream)) { while (sr.Peek() >= 0) { sResponse = sr.ReadLine()); if (! string.IsNullOrEmpty(sResponse)) { do ssomething here.... } } }