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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:29:45+00:00 2026-05-31T23:29:45+00:00

I managed to set up a server(on PC) and a Client (on device) thru

  • 0

I managed to set up a server(on PC) and a Client (on device) thru the IP address .Now I want to send a meesage to the PC to move left or right depending if I hit the volume up or down…

Client:

   @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) 
    {
        mtcpclient.write(1); //I need to implement write function..
        return true;
    }
    else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){
        mtcpclient.write(2);//I need to implement write function..
        return true;
    }

    return super.onKeyDown(keyCode, event);
}

Server:

private void processCommand(int command) {//Recieve int and decide to go right or left
    try {
        Robot robot = new Robot();
        switch (command) {
        case 1:
            robot.keyPress(KeyEvent.VK_RIGHT);
            System.out.println("Right");
            break;
        case 2:
            robot.keyPress(KeyEvent.VK_LEFT);
            System.out.println("Left");
            break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
  • 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-31T23:29:46+00:00Added an answer on May 31, 2026 at 11:29 pm

    If your question is how to send data…here is a simple example on how to send data via TCP.

    String message = "Message to server";
    String ipAdd = "127.0.0.1";
    int port = 6789;
    InetAddress ip = InetAddress.getByName(ipAdd);
    Socket clientSocket = new Socket(ip, port);
    DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
    outToServer.writeBytes(message);
    outToServer.flush();
    clientSocket.close();
    

    Then you just need to write a similar listener on your computer.

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

Sidebar

Related Questions

Creating a client server application i have managed to get the server to link
I have a client/server application written in C#/.NET 3.5 that I want to do
I have a instance of Oracle Access Manager set up on Server A and
I have managed to set up Cassandra + Thrift and the Python wrapper for
Is there an easy way to set the volume from managed .net code?
Is it possible to set a tab control style like TSC_BUTTONS on a managed
We've got a set of forms in our web application that is managed by
I am building an C++ application server-client where the client sends an image (170kb)
I've setup-a-msysgit-server-with-copssh-on-windows, following Tim Davis' guide and I was now learning how to use
I'm trying to set up a Windows-based web server, but do the development work

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.