Is it possible to send something like, a Frame or Applet to a target computer?

If not, how would I set it up so that two users from two different computers could interact with the same JFrame or JApplet?

Edit: No I'm not asking for code, just general advice*

use either the The java.net api or the RMI api

Is it possible to send something like, a Frame or Applet to a target computer?

If not, how would I set it up so that two users from two different computers could interact with the same JFrame or JApplet?

Edit: No I'm not asking for code, just general advice*

Well, this is probably not what you are thinking about, but I figured I would throw it out there. I'm not sure what your application is, but I can think of some applications like a two-person game. Let's make it a simple game where there's a simple JFrame. A red square represents player 1's location and a blue square represents player 2's location. Both are painted on the JFrame. The same program is running on both computers and both computers need to know the coordinates of both players.

You could use a socket to send back and forth the new coordinates when a player makes a move. Let's say I'm player 1 and I'm at coordinates (100, 200) and I move right 20 coordinates to (120, 200). I redraw my red square and then I send the new information (120, 200) down the socket to the other player/computer. The other computer (Player 2) receives that message on the socket and updates its Player 1 information and redraws the red square on its screen with the new coordinates. Naturally most games are going to be more elaborate, but it's the same general idea.

Anyway, I'm not sure if that's along the lines of what you are looking for or not, but I figure I'd throw it out there. This approach would not be "sending the Frame", which would be a lot more information. It assumes that the other computer has the program already and hence "has the frame". I suppose you could also send all of the information that makes up the JFrame (i.e. width, height, title, etc.) and send it down a socket. If you are looking for a pre-written function like SendJFrame, I know of no such function, which of course in no way means that such a function does not exist! ;)

At any rate, if the above scenario is not at all what you had in mind, can you please elaborate?

commented: Fairly straightforward advice, as usual =P +1

No actually that's a perfect solution.

I am just not knowledgeable enough about Networking and thought that if the server had to wait for a particular socket (through a block) that either I would have to send the information to the target computer so that the individual can access the game OR I simply have the same program running on both computers and wait until the server has both sockets connected.

Thanks a million. Geeze, do you ever stop thinking? =P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.