• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Network Question, pls help

 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a small help regrading a java program.

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
 
Ernesto Elias-Nieland
Ranch Hand
Posts: 53
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

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
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With socket class can it be done?
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15459
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is in fact a homework assignment.

Excuse me for the lack of knowledge.

Thanks
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic