Viewing the same Applet on multiple clients - java

I have been trying to figure out how i would go about letting multiple clients view the same Applet on Java. I have the code for the the server and the clients and i have a program that I would like them to view. However whenever i test the code I end up with the clients seeing the same program but different instances of it. I want them both to be able to see the same program and see when the other clients make action on the Applet and what not. It would just be for a local connection and I don't have any HTML files at this time.

Related

How to print a string to another application's dialogue box?

Maybe I wasn't searching the right key words, but I couldn't find anything on printing to another application's dialogue box. Most of my searches came to filling a web page, but I want to print a string to dialogue boxes of other applications like you would for logging into game launchers.
The operating system will usually not allow you to write into the memory of other application. So if the other application is unwilling to take your input, it's practically not possible.
If it is willing to take your input, there are several ways:
Accepting input through the standard input - This means you need to open it as a process and write into the output pipe
Having an open web API - the application is listening on a network port and accepting connections (e.g. HTTP) so you can send HTTP requests to it (even from the same machine)
Listening for any other inter-process communication method - either subscribed to a broker you can publish on, or directly listening for connections (let's say on UNIX-domain socket).
If the application is not listening to anything, nor using any shared resource/memory piece, then there's effectively no way.
Unless...
You wrap the application up in an application of yours. The same way the most game launchers and even game cheats do. Then your application will be completely responsible to proxy the output of the other application to the end-user. Your can take its output, augment it a little bit (e.g. add some texts to a rectangle) and then render it to the user.

How to run any program on domain with certain times

I want to make a program that automate login a website then gets data from there with certain times without being called from me or anyone else like datatabese jobs.My problem is I don't know how to run this program from my domain with certain times.
I searched the web then I found selenium driver, some web scrapers and so. These are all working(can do what to do) that when I run the project from my computer via java or reach that files from my domain(PHP or whatever).
Briefly, how could I make a program that automate login(it's not important login stuff just must doing something without being touch its ok for me) .

UI to control machine access

I've a generic design question. Hope you folks can help me. Our technology stack is Java, Angular, Spring and REST. We wish to implement a reservation system (to reserve machines/servers) so that if one user wishes to ssh to a machine then they first reserve it one our UI and then they only can use it and no-one else can.
Do you guys know a way/technology/design where we could control access to machines this way (possibly something like LDAP) ?. Even something where the user logs into our UI, reserves the box by clicking a Reserve button etc and then clicks a Launch button - which could then launch an actual ssh command window or a remote desktop access session etc. In this way we could set a certain predefined username+password for our boxes (which our application could control) and we can allow users to connect to boxes via our UI.
Wondering if any one you had to do anything similiar to this before or if there is anything obvious I'm missing. Is it easy to "launch" a remote desktop connection or indeed an ssh terminal from java.
I'm fine with the UI part, rest, java etc. It's more the connections / logic to the remote machines that I'd like to get peoples thoughts on.
Sorry if this is too generic. I'd like to get some directions on it.
Any thoughts/guidance would be great.
Thanks - Ro

Java applet socket server permissions

I want to make a Java applet, which functions as a socket server (local network ips, or 127 range is fine).
I want this applet to run in a webpage.
the browser can ideally load the webpage from the file system (file://...), but I could install an HTTP server if required.
The applet will need to be able to interact with JavaScript.
I'm having trouble wading through all the docs. Is the above possible? I'm not familiar with java's security model. If I need to sign the applet, or set some special security or configuration settings, that's fine.
edit-
In case anyones curious, the applet does very little. I just want to use it as a bridge so that another program running on the local computer can communicate via sockets. That program supplies values, which javascript will use to update the ui in real time. The ui is complicated, and building it in html/javascript will be a huge time saver. I'd prefer the applet function as the socket server opposed to a socket client, because otherwise then I need to write a seperate program to act as a server in between the applet and the other program.
Is the above possible?
Sure. If you control the security/policy files for that applet & the firewall, it is a single browser deal, it should be doable. You might need to wrap some of the applet methods in a PrivilegedAction if called from JS.

Performance and networking of Eclipse-run applet vs web applet

I have made a fairly simple turn-based multiplayer web game in an applet. My question is about the performance. I was noticing that there was a really long gap between a player taking his turn and the rest of the players seeing all the updates. It could be as long as 10 seconds for a single move/action.
The game runs on a dedicated server and all the players connect to the server as clients. As one player takes his turn, each move/action is sent to the server, and then from the server out to all the other clients. The server usually sends updates in the form of complete game-state objects, but also sends String messages. The client has a separate thread for listening for these updates. This is all done through a socket connection and persistent object input/output streams.
In my attempt to track down where the bottleneck is, I realized that if I run the applet from Eclipse (clicking "run as applet"), there is virtually no delay. So that means the client applets are sending out updates and the server is receiving them and then sending out it's updates perfectly. The bottleneck has to be in the applet's receiving/processing those updates.
I had two Chrome-applets and two Eclipse applets open on the same game. I would make a move on any of them and the two Eclipse applets would receive the server update instantly and the Chrome-applets would take as much as 10 seconds to get a single update.
Is there something import about different about how the applet runs in the browser vs in Eclipse? I know Eclipse is running the applet from local files, but doesn't a web-applet download all the appropriate files when it starts up? Thanks for your help. Let me know if posting some of my code would help.

Categories

Resources