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

  • Home
  • SEARCH
  • 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 7778089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:18:31+00:00 2026-06-01T18:18:31+00:00

I have server and client set up, which is basically a basic text email

  • 0

I have server and client set up, which is basically a basic text email system. I am currently using a PrintWriter to send the text between the server and client. I am trying to create a attachment based system and to do this I am using a ObjectOutputStream.

private static PrintWriter output;
private static ObjectOutputStream outStream;

public ClientHandler(Socket socket) throws IOException
{
    client = socket;
    outStream = new ObjectOutputStream(client.getOutputStream());
    input = new Scanner(client.getInputStream());
    output = new PrintWriter(client.getOutputStream(), true);
}

I currently have the problem where if I try send text via the output printwriter, for some reason extra characters will be added to the beginning of the text that is sent, meaning the program cannot identify key words being passed via the printwriter to the client. The problem will stop if i comment out the creation of the outStream object.

Can anyone give me any advice to try solve this problem of conflict?

  • 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-01T18:18:32+00:00Added an answer on June 1, 2026 at 6:18 pm

    This extra text is coming from the object output stream.

    Attaching an ObjectOutputStream AND a PrintStream to the same outputstream is basically just never going to work. You have to come up with a solution for using 1 or the other. To use just a PrintStream, you might consider converting your object(s) to JSON or XML. On the other hand, you could just use an ObjectOutputStream and write your strings to the ObjectOutputStream

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

Sidebar

Related Questions

I have implement the simple TCP server and TCP client classes which can send
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I have a client-server Silverlight application, which is use Socets. I have server appliaction
We have a Server/Client cybercafe management application which used to work fine on Windows
We have client server based app which saves user related data into a zip
I have a multi threaded client server application which uses Sockets. When a new
I need to modify a .suo file. Basically, I have a client-server application. The
I have a client/server application for which it is beneficial to have the PC
We have an application set up like this: server - client where the client
I am trying to create a simple client/server application using Thrift which is going

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.