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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:08:41+00:00 2026-05-27T08:08:41+00:00

Iam tring to send a file using a socket, but almost always it cuts

  • 0

Iam tring to send a file using a socket, but almost always it cuts the file over the transmission, but the socket never sends an exception, it just does not send all the file.

Trying to solve this im sending the lenght of the file as a header to the server, so it could validate if the file is complete, if not it send a signal back asking for retransmition.

This works, but some times it takes up to 250 tries to get the file well, ¿what do you thinks is happening?, I have in mind sending the file in smaller chunks, but what is a good size for the chunk?,

The files that fails to be send are of a size of 80kb, and some times even a file of 20kb fails!.

any tips?

  • 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-27T08:08:41+00:00Added an answer on May 27, 2026 at 8:08 am

    After sending the file data, you can use the Flush() method to force sending of all local buffered data.
    When sending, TCP breaks the data up into small packets.

    When reading data, the Read() method returns an integer which is the number of bytes actually read.
    Always make sure that the amount you intended to read is the amount that was read.

    int actuallyRead = stream.Read(bufferToStoreData, 0, bytesToRead);
    while (actuallyRead < bytesToRead) {
        actuallyRead  += stream.Read(bufferToStoreData, actuallyRead, bytesToRead - actuallyRead);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send audio file from one computer to other using socket
I am trying to send a file via Bluetooth using the GameKit framework. The
I am trying to send an e-mail using php script but i am getting
I get an Out of Memory Exception when using Http.Put of a large file.
I am sending a bufferedImage over a socket and I am using the example
I am trying to send an HTTP request with the contents of a file
I am trying to write a servlet that will send a XML file (xml
I am trying to send an email from a site I am building, but
I am trying to send an anonymous object over a web service. Is there
I am trying to send email using Exchange 2007 from a console app using

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.