Class Irmo::Socket
In: rbirmo.c
Parent: Object
Methods
block    block    initialize    new    new_server    run   
Public Class methods
block(int argc, VALUE *argv, VALUE self)

Block on a list of sockets

  # Block on a list:

  Irmo::Socket.block([sock1, sock2])
  # Block with a 100ms timeout

  Irmo::Socket.block([sock1, sock2], 100)
new(VALUE klass, VALUE family, VALUE port)

Create a new socket listening on a particular port

  # Create an IPv4 socket listening on port 3030

  sock = Irmo::Socket.new('IPV4', 3030)
  # Create an IPv6 socket on port 4928

  sock = Irmo::Socket.new('IPV6', 4928)
Public Instance methods
initialize(p1, p2)
run(VALUE self)

Check for new packets received at the socket

new_server(VALUE self, VALUE hostname, VALUE world, VALUE if_spec)

Start a new server on this socket Pass a virtual hostname, world to share and the interface specification of the connecting clients

  # Start a new server named 'shoenix.org', the server sharing a world
  # but the client not sharing a world

  server = sock.new_server('shoenix.org', world, nil)
  # Start a new default server, the server sharing a world and the client
  # sharing one back to the server

  server = sock.new_server(nil, world, client_spec)
block(int argc, VALUE *argv, VALUE self)

Block on a socket until new data arrives

  # Block on a socket indefinitely

  sock.block
  # Block on a socket for a maximum of 100ms

  sock.block(100)