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 7045043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:28:55+00:00 2026-05-28T02:28:55+00:00

When i am try to read from SslStream function Read() is never end if

  • 0

When i am try to read from SslStream function Read() is never end if i am not set connection timeout but if i do i’ve got timeout exception. This guy have the same problem http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.read.aspx. I don’t what to do here the code

    public byte[] ReadBytes()
    {
        this.bufferGlobal.Clear();
        byte[] buffer = new byte[this.bufferSize];
        int recv = this.stream.Read(buffer, 0, buffer.Length);
        while (recv != 0)
        {
            addBytes(buffer, ref bufferGlobal, recv);
            recv = this.stream.Read(buffer, 0, buffer.Length);                
        }
        return (byte[])this.bufferGlobal.ToArray(typeof(byte));
    }

Thx in advance.

UPD:

i think i find the answer. I can set read timeout on SslStream equal one, thats value does not make sense for socket alive (its mean you can download huge files and don’t worry about SslStream he wouldn’t close connection or interupt recieve data). I just testing this solution but seems works fine. Thx everybody.

  • 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-28T02:28:55+00:00Added an answer on May 28, 2026 at 2:28 am

    You are reading from a network stream, which means you will not encounter the end of stream until the other side closes its half of the connection. It isn’t enough for it to stop sending data. So, make your other program close the connection after it has sent all data it intends to.

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

Sidebar

Related Questions

Is is possible to try to read from a stream but do not change
In the following code, I try to read data from a plist: -(void)readPreferences {
I get a warning in MSVC++ when I try to read an integer from
I need to read the output from ffmpeg in order to even try the
When I try to use curl or file_get_contents to read something like http://example.com/python/json/ from
I am trying to read from datareader but i am gettin the error Invalid
I am using the example app from android : BluetoothChat. But when I try
When i try to read the xml from java using SAX parser, it is
Ok, this should be dirt simple. I'm trying to read charactes from a serial
I am running the following code to try and read from a text file.

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.