File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Server and Multiclient application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server and Multiclient application" Watch "Server and Multiclient application" New topic
Author

Server and Multiclient application

Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29
I'm working on Server and Multiclient application,im not able to send message from one specific client to another specific client.....How to identify message is from which client and how to send to particular client?.....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
You mean sending messages between clients works in general (after having passed through the server, I assume), just not between a particular set of two clients?


Ping & DNS - my free Android networking tools app
Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29
Ya message will be sent via server,server does work of message exchange between clients....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
What have you done so far to debug the issue? Where does the message get stuck (or vanish) if those two particular clients are involved?
Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29



I have written code for 1 client and server communication,its working fine.......For multi client i just used multithreading concept by extending Thread and overriding run but what next im not getting........
Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29

Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29
package com.simpragma.assignment.serverapplication;


Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Amruta Jegarkal wrote:


I have written code for 1 client and server communication,its working fine.......For multi client i just used multithreading concept by extending Thread and overriding run but what next im not getting........


What next depends on what you need to do. To send the message to all other clients, you need to:
- Loop over all other clients
- for each client, check to see if it is not the same one who sent the message
- if the client did not send the message to the server, send the message to client.

To send the message to just one other client:
- Identify the client to send to
- Get that client
- Send the message to that client


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server and Multiclient application