/socky

A quick and dirty socket helper library

Primary LanguageRuby

Socky

A quick and dirty socket helper library.

Usage

Setup

Socky::Base.setup do |config|
  config.host  = "somewhere.com"
  config.port  = 12345
  config.debug = true
  config.rescue_retries = 3
  config.rescue_classes = [ Socky::Errors::Timeout, Socky::Errors::Socket ]
end

Normal usage

sock = Socky::Base.new
sock.data << "some data"
sock.make!

Block usage

Block usage is also allowed, socket data will be written at the end of the block.

Socky::Base.send do |data|
  data << "some data"
end # send data

Josh Nesbitt / josh@josh-nesbitt.net / josh-nesbitt.net