Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:08:00+00:00 2026-05-25T10:08:00+00:00

There are a couple issues below. One is that Resharper is telling me that

  • 0

There are a couple issues below. One is that Resharper is telling me that the serverResponse value not be used in any execution path. The other has to do with getting the headers for each message. If I issue a TOP 1 0, it does not throw any errors, it just hangs there. If I issue a TOP 1 0 followed by an Environment.NewLine, it tells me "-ERR no such message." I got the code from the following link.

for (int i = 0; i <= messageCount; i++)
{
    _data = "TOP " + i + " 0";
    _sizeOfData = Encoding.ASCII.GetBytes(_data.ToCharArray());
    _networkStream.Write(_sizeOfData,0,_sizeOfData.Length);

    serverResponse = _streamReader.ReadLine();

    while (true)
    {
        serverResponse = _streamReader.ReadLine();

        if (serverResponse == ".") break;
        if (serverResponse.Length > 4)
        {
            if (serverResponse.Substring(0, 5) == "From:")
                lstMessages.Items.Add(serverResponse);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:08:01+00:00Added an answer on May 25, 2026 at 10:08 am

    Why are you sending raw bytes instead of the text as was originally in the article? In fact, I can’t actually get your code to compile because GetBytes returns a byte[] but Write expects a char[]. I can change it to this and at least it compiles:

    char[] _sizeOfData = Encoding.ASCII.GetChars(Encoding.ASCII.GetBytes(_data.ToCharArray()));
    

    But all that does is mask a potential problem that you’ll probably not run into anyway, namely non-ASCII characters. (Your code will cause question marks to appear for non-ASCII characters which if they ever occurred would cause you a headache to debug, but they should never occur in this case.) Instead you can just do this:

    char[] _sizeOfData = _data.ToCharArray();
    

    Anyway, one of the reasons your code hangs is because the code in the article is using WriteLine() which sends a NewLine for you. So either use WriteLine() (recommended) or change your string to:

    string _data = "TOP " + i + " 0\n";
    

    Another reason for hanging is that you’re not flushing after each line:

    _networkStream.Flush();
    

    One more reason you might be hanging is if you’ve got a ton of messages and you’re processing all of this on the UI thread. Don’t mix complexities, output to the Console or something else that you can monitor in realtime until you’ve figured out the network part, then add your object/collection.

    As for the error message, after plugging your snippet of code into the master code from that article and fixing what I mentioned above I am unable to reproduce the error. But if you have no messages available for POP3 download then TOP 1 0 would produce that message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are a couple of different .NET XSLT functions that I see used in
There are a couple of questions similar to this on stack overflow but not
During startup of my WinForms application I'm noting that there are a couple of
The sidebar navigation here: http://dev.southernlivingplants.com/in_the_garden needs some TLC. There are a couple of issues
Couple of issues here I'm not sure on what the issue is but with
There are a couple of tricks for getting glass support for .Net forms. I
There are a couple of open source apps I am trying to recompile to
There are a couple of questions on Stackoverflow asking whether x ( Ruby /
There are a couple of resources on the Internet describing preview 2 of subsonic
There are a couple of data providers to interface with MySQL databases from .NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.