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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:39:48+00:00 2026-06-04T12:39:48+00:00

I have a tcp server which is not in java also its a hardware

  • 0

I have a tcp server which is not in java also its a hardware device , I need to send and receve the data ,

I am connecting with server and sending some configuration data using following code

         this.clientSocket=new Socket("198.168.1.17",9999);
        this.os=new DataOutputStream(this.clientSocket.getOutputStream());
        this.in=new DataInputStream(this.clientSocket.getInputStream());
        System.out.println("Conncted");


          char data[]={0x03,0x03,0x00};
            byte b[]=new byte[data.length];
          for (int i = 0; i < b.length; i++) {
              b[i] = (byte) data[i];
             }
            try {
                os.write(b);

Device receives data correctly , now in my tcp client i am not able to receive data , though i write following code just after above code

            int size =in.available();
                byte data1[]=new byte[size];
              //  in.read(data1);
                String str=new String(data1);
                System.out.println("Reading data:"+str);

It only shows reading data , and string has not data
also i tried about code in thread

      public void run(){
try{
    while(true){
        int size =in.available();
        byte data[]=new byte[size];
        in.read(data);
        String str=new String(data);
        System.out.println("Reading data:"+str);



    }

in thread it only shows reading data ,
Please help how can i get data from the server also please note server is built in i can not change the server code

  • 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-04T12:39:50+00:00Added an answer on June 4, 2026 at 12:39 pm

    what available() method do in code “int size =in.available();”????????

    Solution may be:
    available() method return 0 so you are not able to receive data.

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

Sidebar

Related Questions

I have a java server which is using TCP and sockets to connect to
I have a Java Client which sends UTF-8 strings to a C# TCP-Server, I'm
I have created a TCP server-client application in java which exchange periodic messages between
I have a TCP server application in which on receiving an incoming connection, I
I have a TCP server in Perl (revision 5.0 version 8 subversion 0) which
I have a client-server application which communicates over TCP/IP. I use System.Net.Sockets.Socket type object
I have a TCP server software in C#. I am reading data that is
I have the following algorithm implemented in Java which uses TCP/IP: -Client request a
I have a TCP/IP server written in C# .net which can have 10,000 connections
I have made a TCP server which I have been testing locally and it

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.