Module: EventMachine::RubySockets
- Defined in:
- lib/em-ruby-sockets/version.rb,
lib/em-ruby-sockets/tcp_client.rb,
lib/em-ruby-sockets/file_streamer.rb,
lib/em-ruby-sockets/tcp_connection.rb,
lib/em-ruby-sockets/errors.rb,
lib/em-ruby-sockets.rb
Defined Under Namespace
Modules: TcpConnection Classes: Error, FileStreamer, TcpClient
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.tcp_connect(ip, port, klass = EM::RubySockets::TcpClient) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/em-ruby-sockets.rb', line 15 def self.tcp_connect ip, port, klass=EM::RubySockets::TcpClient raise EM::RubySockets::Error, "EventMachine is not running" unless EM.reactor_running? sock = ::Kgio::TCPSocket.start(ip, port) conn = EM.watch sock, klass conn.post_init conn.send :init block_given? and yield conn conn end |