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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:38:00+00:00 2026-05-20T21:38:00+00:00

Hello I was doing a program of taking a snapshot of remote computer. I

  • 0

Hello I was doing a program of taking a snapshot of remote computer.

I have done up to.

ScreenServer.java.

import java.net.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.ImageIO;

public class ScreenServer {
    public static void main(String[] args) throws Exception {
        Robot robot = new Robot();
        BufferedImage screen;

        while (true) {
            ServerSocket server = new ServerSocket(6659);
            Socket client = server.accept();

            Rectangle size = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
            screen = robot.createScreenCapture(size);
            int[] rgbData = new int[(int) (size.getWidth()*size.getHeight())];
            screen.getRGB(0,0, (int) size.getWidth(), (int) size.getHeight(), rgbData, 0, (int) size.getWidth());

            OutputStream baseOut = client.getOutputStream();
            ObjectOutputStream out = new ObjectOutputStream(baseOut);

            ImageIO.write(screen, "png", new File("d:\\orig_screen.png"));
            out.writeObject(size);

            for (int x = 0; x < rgbData.length; x++) {
                out.writeInt(rgbData[x]);
            }

            out.flush();
            server.close();
            client.close();
            out.close();
            baseOut.close();
        }
    }
}

ScreenClient.java

import java.net.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.ImageIO;

public class ScreenClient {

    public static void main(String[] args) throws Exception {
        Socket server = new Socket("172.22.6.50",6659);

        ObjectInputStream in = new ObjectInputStream(server.getInputStream());

        Rectangle size = (Rectangle) in.readObject();

        int[] rgbData = new int[(int)(size.getWidth() * size.getHeight())];

        for (int x = 0; x < rgbData.length;x++) {
            rgbData[x] = in.readInt();
        }

        in.close();
        server.close();

        BufferedImage screen = new BufferedImage((int) size.getWidth(), (int) size.getHeight(), BufferedImage.TYPE_INT_ARGB);

        screen.setRGB(0,0, (int) size.getWidth(), (int) size.getHeight(), rgbData, 0,(int)size.getWidth());

        ImageIO.write(screen, "png", new File("d:\\screen.png"));
    }
}

But it’s not working properly. The server takes it’s own snapshot. Please provide a solution.

  • 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-20T21:38:01+00:00Added an answer on May 20, 2026 at 9:38 pm

    The server takes it’s own snapshot…

    Well, obviously it can’t take a snapshot of the screen of some other random computer. It would be a massive security hole if it could do that!!

    If you want to take a snapshot of a computer’s screen, you have to do it from a program executing on that computer, or via some remote desktop protocol. In other words, the computer has to be set up / configured to allow this to happen.


    I think your problem is that you are simply misunderstanding the way those two programs are intended to be used. You are supposed to run the ScreenServer app on the machine whose screen you want to snapshot and the ScreenClient app on the machine where you want to view the snapshot.

    You should also be aware that if you run the ScreenServer app on a machine, any other computer on the network can capture its screen. This is very insecure.

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

Sidebar

Related Questions

hello i m doing a very simple Asp.net application project namespace WebApplication1 { public
Hello I am in the process of doing a school project, where we have
Currently I am doing this: I have text that looks like: Hello ${user.name}, this
Hello I am doing a program that will notice when a specific key is
So I am trying to run console 64 bit Hello World program. I have
I have simple Hello World C++ program (main.cpp): #include <iostream> using namespace std; int
Say I have the following c program: #include <stdio.h> int main() { printf(Hello world
Hello I am new to WPF and i do have some experience in ASP.NET
I'm new to Java and IntelliJ and I am just doing a simple hello
I have downloaded the java JDK but I am unable to run the program.

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.