I need to have 3 clients and a server. The programs should communicate via TCP. The server should be called first and waits for a connection request from the clients which are on a different machine that will connect to server. After connection is established, the client prgram prompts the user to type a line of text, send it to server. The server reads the data, reverse it and send it back to the client. After responsding to clients, server should close the connection.
How can I do this?
Thanks
Never take anything for granted because you never know when you will lose it
I thing two popular APIs for this are the RMI- und the XMLRPC-API. With both objects can communicate via Networks. I think for simple applications XMLRPC is better because its much easyer to use. Your client application just has to call a method of your server application which passes the string to the server. In response the server has to call a method on you client with passes the string back.
Ernie
0x2B | ~0x2B
SCJD, SCJP 1.5, SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJA, IBM Test 150, 142, 700, 701, Oracle Test 1Z0-51
Pol Appan
Ranch Hand
Joined: Aug 26, 2004
Posts: 144
posted
0
With socket class can it be done?
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
posted
0
yes
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
See the Custom Networking trail in The Java Tutorial to learn about network programming with Java.
What Ernesto proposes, doing it via RMI (Remote Method Invocation) or XML-RPC (Remote Procedure Calls via XML), is also possible, but I think it's a good idea to learn how it works with sockets first.
Originally posted by Jesper Young: I think it's a good idea to learn how it works with sockets first.
That's probably why the request sounds like a homework assignment...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Pol Appan
Ranch Hand
Joined: Aug 26, 2004
Posts: 144
posted
0
It is in fact a homework assignment.
Excuse me for the lack of knowledge.
Thanks
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
posted
0
Originally posted by Cosmos Ja:
Excuse me for the lack of knowledge.
That's nothing to excuse for. When you've read the tutorial, come back with any questions that remain.
Naturally, we won't do your homework for you, but if show that are putting effort into it yourself, we are more than willing helping you with the details.