• Post Reply Bookmark Topic Watch Topic
  • New Topic

Communication between client and server

 
varun narisetty
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
jetti madhu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dawn,
How to establish connection between different machines other than local host through socket programming.

Regards,
Bhavani.G
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!