Distributed computing] How to let a class act both a server and client?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Distributed computing] How to let a class act both a server and client?

  1. #1
    Join Date
    Oct 2003
    Posts
    4

    Distributed computing] How to let a class act both a server and client?

    I am imlementing a didtributed banking system.
    There are 4 bank branchs need to communicate to each other ,get balance and transfer money from one branch to another, so they need to act both as a server and client?

    I know how to write a program in a standard client communicates to server and server respond to cliemt but I have no idea how to let them both act as a server and client.

    And if I use socket, the client (or server) will just send a stream to server, so how could the server (or client) know what's kind of operation he need to do?

    Anyone know how to do it? Please help me.

    thanks

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    You've got loads of ways you could implement this.

    From your post, I'm assuming you're not going to use RMI.

    If so, then it might be worth creating a little protocol for your system to use. For example, the first word use in the communication is the operation required, following by its details. For example:
    Code:
    BALANCE
    SEND 32155
    RECEIVE 2132
    The first command asks for the balance of the branch that the command is sent to. The second command requests the transfer 321.55 *to* the branch that the command is sent to. The third command requests the transfer of 21.32 *from* the branch tha the command is sent to.
    ArchAngel.
    O:-)

  3. #3
    Join Date
    Oct 2003
    Posts
    4
    If I use RMI, how should I do to let a class both act as a server and client?

  4. #4
    Join Date
    Mar 2003
    Posts
    834

    Thumbs down

    If you haven't done RMI before I wouldn't recommend it to do this coursework - it takes a bit of getting used to. Sockets will do fine.
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center