root/version_1/README

Revision 652, 3.6 kB (checked in by blackhedd, 11 months ago)

wording tweak

  • Property svn:keywords set to Id
Line 
1 $Id$
2
3 = RUBY/EventMachine
4
5 Homepage::  http://rubyeventmachine.com
6 Copyright:: (C) 2006-08 by Francis Cianfrocca. All Rights Reserved.
7 Email:: gmail address: garbagecat10
8
9 EventMachine is copyrighted free software made available under the terms
10 of either the GPL or Ruby's License. See the file COPYING for full licensing
11 information.
12 See EventMachine and EventMachine::Connection for documentation and
13 usage examples.
14
15 EventMachine Version 1 has the same extensive feature support as Version 0,
16 but is designed for easier integration with Ruby itself. It also has a cleaner
17 separation between the low-level event functions and the  higher-level application
18 and protocol-support functions.
19
20 EventMachine implements a fast, single-threaded engine for arbitrary network
21 communications. It's extremely easy to use in Ruby. EventMachine wraps all
22 interactions with IP sockets, allowing programs to concentrate on the
23 implementation of network protocols. It can be used to create both network
24 servers and clients. To create a server or client, a Ruby program only needs
25 to specify the IP address and port, and provide a Module that implements the
26 communications protocol. Implementations of several standard network protocols
27 are provided with the package, primarily to serve as examples. The real goal
28 of EventMachine is to enable programs to easily interface with other programs
29 using TCP/IP, especially if custom protocols are required.
30
31 A Ruby program uses EventMachine by registering the addresses and ports of
32 network servers and clients, and then entering an event-handling loop.
33 EventMachine contains glue code in Ruby which will execute callbacks to
34 user-supplied code for all significant events occurring in the clients
35 and servers. These events include connection acceptance, startup, data-receipt,
36 shutdown, and timer events. Arbitrary processing can be performed by user code
37 during event callbacks, including sending data to one or more remote network
38 peers, startup and shutdown of network connections, and installation of new
39 event handlers.
40
41 The EventMachine implements a very familiar model for network programming.
42 It emphasizes: 1) the maximum possible isolation of user code from network
43 objects like sockets; 2) maximum performance and scalability; and 3) extreme
44 ease-of-use for user code. It attempts to provide a higher-level interface
45 than similar projects which expose a variety of low-level event-handling
46 and networking objects to Ruby programs.
47
48 The design and implementation of EventMachine grows out of nearly ten years
49 of experience writing high-performance, high-scaling network server applications.
50 We have taken particular account of the challenges and lessons described as
51 the "C10K problem" by Dan Kegel and others.
52
53 EventMachine consists of an extension library written in C++ (which can be
54 accessed from languages other than Ruby), and a Ruby module which can be dropped
55 into user programs. On most platforms, EventMachine uses the
56 <tt>select(2)</tt> system call,
57 so it will run on a large range of Unix-like systems and on Microsoft
58 Windows with good performance and scalability. On Linux 2.6 kernels, EventMachine
59 automatically configures itself to use <tt>epoll(4)</tt> instead of
60 <tt>select(2),</tt> so scalability on that platform can be significantly
61 improved.
62
63 Here's a fully-functional echo server written with EventMachine:
64
65       require 'rubygems'
66       require 'eventmachine'
67
68       module EchoServer
69         def receive_data data
70           send_data ">>>you sent: #{data}"
71           close_connection if data =~ /quit/i
72         end
73       end
74
75       EventMachine::run {
76         EventMachine::start_server "192.168.0.100", 8081, EchoServer
77       }
78
79
Note: See TracBrowser for help on using the browser.