• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java Network Question, pls help

 
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
 
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?
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • 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.
 
author
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
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.
 
The only thing that kept the leeches off of me was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic