This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.



Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI Client  RSS feed

 
Francis John
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all....
It's really important to me to know about that thing which is related to RMI.....plz help me in this regard....
My problem is that how i can send particular file to particular client..
In my scenario, few of clients are connected or i can say registered...so in that manner i will get that client's hostname by using gethostClient() method but i want to ask u that how i can send anything to any particular client with which function i mean is there any function using like getInetAddress() or some other function so that i can send any particular thing(eg.string) to that client...using its address..
plz tell me ....
I m waiting for reply bcoz it's needed soon..

Bye
 
Krishna Mohan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Francis see this link.
client callback
hope that helps
 
Francis John
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mohan and others...
I m already using Callback mechanism but again my problem is still there...I will explain u people....
First clients are registered to servers.....but at any time of their registration i mean if that time user inputs the string (It has been done through web page, it can be accessed at any time) when only 3 clients are registered then i have to use distribute method to distribute different tasks to different clients....The problem is that how i can get client address at the time of distribution after registering I know i ve all the client address by using getClientHost() but how i can use that method to send task to them.....Is there any method or any mechanism..i ven't found anything in the books,few tutorials...plz help me in this regard...
Thanx in advance....
Hope i get positive reply soon
Good Luck & Bye
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Francis,
Wow, you've been struggling with this problem for some time!
I don't understand the difficulty you're having. When a client connects, you should have it register a callback object. This callback object is basically a pointer the server can use to connect back to the client. When the time comes, the server can call methods on the callback object, and in doing so, it will be sending the file data to the client. You don't need to explicitly get the client's address -- RMI handles this under the hood.
To put it another way: define a SendFilesToMe remote interface. This remote interface has a method called "hereIsAFile(String filename, byte[] contents)". Implement it in the client. Then the client should pass a SendFilesToMe object to the server. The server should call hereIsAFile() on this object, and by doing so, it has effectively sent a file to the client.
Do you understand what I'm saying?
 
Francis John
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir Friedman-Hill!
Thanx, to reply me, Yes, It's true i m still facing problem which i cant handle.....
u r right that i ve already addresses of clients even in my program i ve in hashtable...the list is maintained.....
But when i got input i ve to use method distribute at that time....and it's right that i ve to distribute different files to them.....
Whatever the mechanism u ve defined in the last reply,,,it's absolutely right for sending one file but what about for the different files to differnt clients....
I m right to ask or not?? plz sort out my problem....
Good Luck & Bye
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

what about for the different files to differnt clients....

Try as I might, I can't imagine how this is a particular problem. Sending different files to different clients means sending file A to client A, and file B to client B, etc, and I can't see how it's any different than just sending one file to one client.
Can you describe, as clearly as possible, what the actual problem you're having is?
 
Francis John
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again!!
Really, u r right.....i m facing problem might be implementing this thing in a right manner....
anyway,if u dont mind to tell me in the form of code then i will understand it clearly and then implemented in my program....
Take Care & Bye
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!