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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:27:20+00:00 2026-06-14T06:27:20+00:00

I am experiencing a strange situation. I have two applications: client side socket in

  • 0

I am experiencing a strange situation.
I have two applications: client side socket in Android and Java socket server runs the server in the context of application startup.
Between the client and the server are sent using JSON STRING URLEncoder in each field that is to avoid string parsing to JSON.
If sent from client to server in JSON STRING reached only 1 post. When I try to send the second is not sent to the server. It is somewhere you know.
Now if STRING shipping without any special formatting eg ABCDEFG12331 always arrive at the server.

example how client sent or server response:

byte[] data = strText.getBytes("UTF-8");
DataOutputStream d = new DataOutputStream(wsSocket.getOutputStream());
d.write(data);
d.flush();

example how client read or server read

int maxBuffer = Math.max(wsIS.available(), 8192);
byte[] buffer = new byte[maxBuffer];
int size = wsIS.read(buffer);
if (size == -1) {
  break;
}
StringBuilder str = new StringBuilder();
str.append(new String(buffer, "UTF-8").substring(0, size).trim());
  • 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-14T06:27:21+00:00Added an answer on June 14, 2026 at 6:27 am

    Since you haven’t mentioned much about the code,

    One thing that both client and server should follow in this case is to use BufferedReader/Writer and should the data channel being left open should then allow the strings to read after every flush().

    Also, make sure that close() is not being called at any time.

    Another pointer is – at server end once you get the client connection, then preserve the reference of the inputStream and outputStream, since these must be used whenever the data exchange happens. Otherwise, from any other new reference, you would not be able to perform the operation

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

Sidebar

Related Questions

I am experiencing some strange behaviour in my Java server application whereby database operations
I'm experiencing some strange behavior in Eclipse. I'm trying to export my Android application,
I am experiencing some strange behavior with SQL Server CE 3.5 SP2. I have
I am experiencing strange log cat behaviour in my app, either I have two
I'm experiencing this strange situation. I have a UITableView where, when the user selects
I am building an application for the android Phone and am experiencing some strange
I am experiencing strange behavior using git stash, I have two branches v0 and
Problem description After a while of running my java server application I am experiencing
We've been experiencing a strange deadlock during the startup of our java application. When
Im experiencing a strange situation which i was supposed to handle. The situation is:

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.