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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:20:09+00:00 2026-06-01T20:20:09+00:00

I am trying to write an application using Java that will allow me to

  • 0

I am trying to write an application using Java that will allow me to transfer files between a server and a client that requests the file. I plan to do it using sockets. My algorithm is somewhat like this:

On Server:
Create the connection between client and server.
Once connected find the file u need to send to client.
Then send the size of file to client.
Then send file broken down in parts.

On Client
After connection is created, ask for the file.
Receive the file size, then accept data till u reach file size.
Stop.

Please correct me if i am wrong somewhere in the algorithm

  • 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-01T20:20:10+00:00Added an answer on June 1, 2026 at 8:20 pm

    This isn’t really an “algorithm” question; you’re designing a (simple) protocol. What you’ve described sounds reasonable, but it’s too vague to implement. You need to be more specific. For example, some things you need to decide:

    • How does the receiving program know what filename it should save to? Should that be sent through the socket, or should it just ask the user?
    • How is the file size transmitted?
      • Is it a character string? If so, how is its length indicated? (With a null terminator? A newline?)
      • Is it a binary value? If so, how big? (32 bits or 64?) What endianness?
    • What does “broken down in parts” mean? If you’re writing to a TCP socket, you don’t need to worry about packet boundaries; TCP takes care of that.
    • Does the recipient send anything back, like a success or failure indication?
    • What happens when the whole file has been transmitted?
      • Should both ends assume that the connection must be closed?
      • Or can you send multiple files through a single connection? If so, how does the sender indicate that another file will follow?

    Also, you’re using the terms “client” and “server” backward. Typically the “client” is the machine that initiates a connection to a server, and the “server” is the machine that waits for connections from clients.

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

Sidebar

Related Questions

I'm trying to write a Java application that manipulates high resolution .wav files. I'm
I am trying to write a Java application that will query the WMI on
I am trying to write a small application using bouncycastle algorithm, from the BouncyCastleProvider.java
I'm trying to write an application that converts 48 bit-per-pixel PNG files to a
I am using IBM Websphere Application Server v6 and Java 1.4 and am trying
I am trying to write a simple Http client application in Java and am
I'm running a java application that we distribute as a server-side system. I'm trying
I am trying to write a Java applet that will read from a user's
I'm trying to write a facebook application using Java tomcat with RestFB. the restfb
I'm trying to write a java application that accesses the usb ports to read

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.