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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:06:46+00:00 2026-05-28T11:06:46+00:00

My client first creates a url object with the url of the server (containing

  • 0

My client first creates a url object with the url of the server (containing the servlet) and sends data to the servlet using the following code:

URL url = new URL("http://localhost:8080/hello");
    URLConnection connection = url.openConnection();
    connection.setDoOutput(true);

    ObjectOutputStream out=new ObjectOutputStream(connection.getOutputStream());
    out.writeObject(stringToReverse);

After receiving the required data from the server, the client again needs to send a data to the servlet. Should I close the above ObjectOutptStream and create a new one within the same connection to send the data? How should it be done?

Another question that I have is that each time I write data into the outputstream of the client, should I create a separate ObjectInputStream in the servlet?

  • 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-28T11:06:46+00:00Added an answer on May 28, 2026 at 11:06 am

    Since these are all specific to a connection that ends as soon as the data is sent, I would suggest just instantiating them each time you make a connection. These objects are initialized using constructors instead of setter methods, and this suggests that the classes were not intended to be reused over and over again..

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

Sidebar

Related Questions

Starting with no cache on server or client FIRST REQUEST GET /post/1 HTTP/1.1 HTTP/1.1
I'm trying to make my first web service client for the eBay API using
I'm interested in putting together my first online game using Flash as the client
I have a SharePoint List to which I'm adding new ListItems using the Client
i m relatively new in Objective C, i have designed a server-client application and
I have two webapps: a web-service client and a server (both CXF-based, using the
I'm doing some wsdl- and client-first development in C# with WCF (the wsdl and
I have two websites on the same machine. The first (client) references a WCF
I've finally found a client for my hosted software - the first time I've
Wanting to implement authentication by client certificates I am experiencing some issues. First some

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.