public NetworkStream NetStrm; ... NetStrm = Server.GetStream();You've just declared it as a plain ol' Stream:
Stream NetStrm = Server.GetStream();
Makes a bit of a difference. <g>>TcpClient Server = new TcpClient(_sPOP3Server, 25); >Stream NetStrm = Server.GetStream(); >StreamReader RdStrm = new StreamReader(Server.GetStream()); >string s = RdStrm.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.... >> } >> } >>} >> >>