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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:05:30+00:00 2026-06-19T04:05:30+00:00

my todays problem is the following: I have a network connection, at which both

  • 0

my todays problem is the following:

I have a network connection, at which both sides have to send commands (bytes), but my reader blocks my writer, thats how it seems to be. If I “disable” my reader (by deleting the reader from source) the writer works as he should, But when my reader is there, too, my writer just do the half of the work.

Lets say my writer has to send a command with an interval of 15 seconds and stay aware of incoming commands whach has to be answered by a little byte block. The answer block is send, but the command from the interval seems blocked.

Here my source:

    protected String doInBackground(URL... params) {
        try {
            btw1 = (byte) sendbeg;
            btw2 = (byte) w2;
            btw3 = (byte) w3;
            btw4 = (byte) w4;
            btw5 = (byte) w5;
            if (w5 == 79) {
                btw6 = (byte) mins;
                btw7 = (byte) seks;
                btw8 = (byte) w6;
                btw9 = (byte) sendend;
            } else {
                btw6 = (byte) w6;
                btw7 = (byte) sendend;
            }
            SocketAddress sockaddr = new InetSocketAddress("192.168.0.7", 2001);
            sock = new Socket();
            int timeout = 1000; // 1000 millis = 1 second
            sock.connect(sockaddr, timeout);
            sock.setReuseAddress(true);
            System.out.println(sock);
            DataOutputStream dos = new DataOutputStream(
                    (OutputStream) sock.getOutputStream());
            BufferedWriter wrtr = new BufferedWriter(
                    new OutputStreamWriter(dos), 300);
            DataInputStream dis = new DataInputStream(sock.getInputStream());
            BufferedReader rdr = new BufferedReader(new InputStreamReader(dis),
                    300);
            getbyte((byte) btw1, (byte) btw2, (byte) btw3, (byte) btw4,
                    (byte) btw5, (byte) btw6, (byte) btw7, (byte) btw8,
                    (byte) btw9, (byte) btw10); //getbyte works fine, too. It's just there for putting the single bytes into an array.
            System.out.println(btw.length);
            dos.write(btw);
            diny1 = (dis).read();           
diny2 = (dis).read();           
diny3 = (dis).read();           
diny4 = (dis).read();

            diny5 = (dis).read();           
dinymin = (dis).read();
            dinysek = (dis).read();
            diny6 = (dis).read();
            diny7 = (dis).read();
            if (diny5 != 79) {
                System.out.println("diny" + diny1 + " " + diny2 + " " + diny3
                        + " " + diny4 + " " + diny5 + " " + dinymin + " "
                        + dinysek);
            } else {
                if (diny7 != 5) {
                    diny6 = 0;
                    diny7 = 0;
                }
                System.out.println("diny" + diny1 + " " + diny2 + " " + diny3
                        + " " + diny4 + " " + diny5 + " " + dinymin + " "
                        + dinysek + " " + diny6 + " " + diny7);
            }
            dos.close();
            wrtr.close();
            dis.close();
            rdr.close();
            if (diny5 != 32) {
                sendbeg = 3;
                w2 = diny3;
                w3 = diny2;
                w4 = 48;
                w5 = 32;
                w6 = 11;
                sendend = 5;
                System.out.println(diny5 + " ^^ ");
                doInBackground();

            }
            System.out.println("case 144-49-000.1" + context);
            reccom(context);
            sock.close();

        } catch (Exception e) {
            e.printStackTrace();

            System.out.println("IO error " + e);
        }

        return "Done";
    }

My intervalsource works fine, because it works, if the reader is inactive, so i think the problem is in this code above. please help.

  • 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-19T04:05:32+00:00Added an answer on June 19, 2026 at 4:05 am
    • You can delete the setReuseAddress() call; it’s only for server sockets.
    • AsyncTask is not exactly the right class for your readers and writers if you stay in a loop there all the time; it would be more suitable to use Thread.
    • It sounds as if you need a seperate reader and writer Thread if one is not allowed to block the other.
    • You’ll probably have to use synchronized along the way if reader and writer act independently
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem. I need to do the following: get todays date make
Today I ran into the following problem with NUnit. I have a class, that
I faced an interesting problem today. I have 4 strings which I need to
I have recently learned to create dynamic links via php, but my problem today
I have the following problem. If I ask graphite for a chart from 2
I have the following problem that needs to be solved in a MySQL query:
today i've bumped in the following problem. I have the following xml: <c:docschema xmlns:c=http://www.otr.ru/sufd/document/desc
I am receiving the following error and cannot find the problem: You have an
i have the following problem: i work in web application and only today. any
I have created the following to explain my problem. Given a list with PayDates

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.