20.1. An Overview: Using drb

A drb application has two basic components—a server and a client. A rough breakdown of their responsibilities is as follows:

The server:

  • Starts a TCPServer and listens on a port

  • Binds an object to the drb server instance

  • Accepts connections from clients and responds to their messages

  • May optionally provide access control (security)

The client:

  • Establishes a connection to the server process

  • Binds a local object to the remote server object

  • Sends messages to the server object and gets responses

The class method start_service takes care of starting a TCP server that listens on a specified port; it takes two parameters. The first is a URI (a Universal Resource Identifier) specifying a port (if it is nil, a port will be chosen ...

Get The Ruby Way: Solutions and Techniques in Ruby Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.