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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:51:38+00:00 2026-06-09T12:51:38+00:00

I try to type a single program have (client) and (multi-client server) to send

  • 0

I try to type a single program have (client) and (multi-client server) to send and receive files
The transfer is totally successfully but the program (Not responding) when it transfer data and return normaly when it finish

You can download the project with link:
http://www.mediafire.com/?81gs1zqbsgqldwb

please help me how to fix (Not responding) when the program transfer data ???

The send mechanism :

byte[] buffer = new byte[packetSize];
while (sum < length)
{
    if (length - sum > packetSize)
    {
        count = fileStream.Read(buffer, 0, packetSize);
        Send(socket_File, buffer);
    }
    else
    {
        buffer = new byte[length - sum];
        count = fileStream.Read(buffer, 0, length - sum);
        Send(socket_File, buffer);  
    }
    sum = sum + count;
}
fileStream.Close();

The receive mechanism :

string path = Save_File.FileName;
FileInfo fi = new FileInfo(path);
FileStream fs = fi.OpenWrite();
byte[] buffer = new byte[packetSize];

while (sum < File_Size)
{
    if (File_Size - sum > packetSize)
    {
        count = Socket_File_Client.Receive(buffer, 0, packetSize, 0);
        fs.Write(buffer, 0, count);
    }
    else
    {
        buffer = new byte[File_Size - sum];
        count = Socket_File_Client.Receive(buffer, 0, File_Size - sum, 0);
        fs.Write(buffer, 0, count);
    }
    sum = sum + count;
}
fs.Close();
  • 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-06-09T12:51:39+00:00Added an answer on June 9, 2026 at 12:51 pm

    Regular IO as in your code is blocking. This means that the thread that is executing your code will have to wait until the transfer is completed. If this thread is the main thread in your program then it will cause your program to be unresponsive to user input (“Not Responding”) until it is finished.

    You have two ways to make your program responsive while doing blocking IO:

    • Use asynchronous IO
    • Run your transfer in another thread

    I think the second option is probably easier in your case.

    Just use ThreadPool.QueueUserWorkItem or BackgroundWorker. See this article for explanations and details.

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

Sidebar

Related Questions

I have got the following exception when try to select data from SQL Server
Lets say I have a single object of type Car which I want to
What test text do you try and type into your web forms to check
Here is my try: @header(Content-type: text/html; charset=utf-8); @header(Location:/index.php); @header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 @header(Expires:
I try to implement an initialization method for my own type. However after calling
I get a Data type mismatch criteria expression error when i try to retrieve
If you try to cout a pointer to a volatile type, even a volatile
When I try to run update a credit card type by passing in the
Take this code into consideration: Proxy p = new Proxy(Type.SOCKS, new InetSocketAddress(proxyURL, port)); try
I have the following: C:\temp\dowork.exe < input.txt processing....... complete C:\ I try this: processArguments

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.