aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes Communication between client and server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "Communication between client and server" Watch "Communication between client and server" New topic
Author

Communication between client and server

varun narisetty
Greenhorn

Joined: Oct 14, 2009
Posts: 8
I need to run a server side program such that it will run in background and wait for the client message. and at client side i need to send a message to server. and at server depending on the message i got from the client i need to run a piece of code.
I don't know much of socket programming i will be thankful if any one can post a sample code or else any link to the sample code.

thanking you in advance,
Varun Narisetty
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
I understand that you are looking for code directly... but I'd recommend you try doing it by yourself.. here are the hints.

1) ServerSocket is a java class which can create a socket (IP/Port combination) in the server, and keep listening for incoming packets.
2) Socket is another java class which can communicate to any other socket or serversocket.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
As is so often the case, the Sun Java Tutorial has examples of exactly that. Start reading at http://java.sun.com/docs/books/tutorial/networking/sockets/index.html


Android appsImageJ pluginsJava web charts
jetti madhu
Greenhorn

Joined: Feb 22, 2010
Posts: 6
Dear Thammudu ,

you need to follow these steps to see success

1) I think you don't know much of socket programming you will be thankful if any one can post a sample code or else any link to the sample code in formus.
2)you need to run a server side program such that it will run in background like THREADS and wait for the client message.
3)At client side you need to send a message to server through protocals either TCP or UDP/WI-FI
4) At server depending on the message you got from the client you need to run a piece of code in background process.


For code visit www.kickadz.com

Prematho,
Mee muddhula anna
vani golakoti
Ranch Hand

Joined: May 27, 2010
Posts: 31
Hi Dawn,
How to establish connection between different machines other than local host through socket programming.

Regards,
Bhavani.G
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
vani golakoti wrote:How to establish connection between different machines other than local host through socket programming.

If the method explained in the link I posted doesn't work for you for some reason, then you should tell us *why* that is. It is the standard approach, after all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between client and server
 
Similar Threads
B&S: Mode flag "alone" question
heartbeat messages help
How to limit webservice calls suppose 50 at a time while invoking webservice client.
Webservices-need help
can i run applet on server?