arunthampi-evented_net 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +21 -23
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -8,30 +8,28 @@ The aim of this library is to make a consistent API for both synchronous and eve
|
|
8
8
|
|
9
9
|
== Sample Code which uses EventedNet::HTTP POST call
|
10
10
|
|
11
|
-
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
require '
|
15
|
-
require 'cgi'
|
11
|
+
require 'rubygems'
|
12
|
+
require 'evented_net'
|
13
|
+
require 'evma_httpserver'
|
14
|
+
require 'cgi'
|
16
15
|
|
17
|
-
class Handler < EventMachine::Connection
|
18
|
-
|
16
|
+
class Handler < EventMachine::Connection
|
17
|
+
include EventMachine::HttpServer
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
def process_evented_http_req(code, body)
|
20
|
+
puts "Code: #{code} Body: #{body}"
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def process_http_request
|
24
|
+
uri = URI.parse('http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi')
|
25
|
+
EventedNet::HTTP.post(uri, :callback => method(:process_evented_http_req), :params => {:Comments => 'Testing Attention Please'})
|
26
|
+
end
|
27
27
|
end
|
28
|
-
|
29
|
-
|
30
|
-
EventMachine
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
</pre>
|
28
|
+
|
29
|
+
EventMachine::run {
|
30
|
+
# When running on Mac OS X, use EventMachine.kqueue
|
31
|
+
# When running on Linux 2.6.x kernels, use EventMachine.epoll
|
32
|
+
EventMachine.kqueue
|
33
|
+
EventMachine::start_server("0.0.0.0", 8082, Handler)
|
34
|
+
puts "Listening"
|
35
|
+
}
|