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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:34:47+00:00 2026-05-23T09:34:47+00:00

Problem i have a C# application which receive a stream from a socket client

  • 0

Problem

i have a C# application which receive a stream from a socket client , after retrieving the stream i need to accept a another stream sent by the client ,

Current Code

   int length= this.DataSocket.Receive(this.buffer, this.buffer.Length, SocketFlags.None);

 // saves the first file ..... 

   length= this.DataSocket.Receive(this.buffer, this.buffer.Length, SocketFlags.None);

Details

im sure that im writing data from the socket client but after first file receive 2nd DataSocket.Receive hangs and no stream is been received.. any idea?

  • 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-23T09:34:47+00:00Added an answer on May 23, 2026 at 9:34 am

    A network stream in isolation has no automatic segregation of messages – it is all just bytes. As such, it is necessary to split manually; the most convenient to write is using a known delimiter between records. The most convenient to read is to prefix each message with the number of bytes to read in the next message.

    You need to use this information to read entire messages, otherwise the reading goes mad. In this case, I suspect you read both messages completely in the first Receive, and now there is no more data – hence the blocking (it must block until either at least one byte can be read, or it is closed).

    Also – note that because you read doesn’t mean you have a full message – just at least one byte. You usually need to loop to get a message.

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

Sidebar

Related Questions

I have a application which uses socket connection to send and receive data from
I have a client server application in which the server and the client need
Task: have a jailbroken iPhone need to write an application which would receive notifications
I have a problem with an application which uses the same stored procedure over
I have a problem with a little .Net web application which uses the Amazon
I have this .bat script which I use to maven package my application. Problem
Iam working in c++ .i have an problem while run an application ,which have
I have a server application and a client application. I'm using socket to communicate
Hi I have an application which after login, loads a main activity which contains
I have a number of devices from which i need to get status updates.

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.