/* * Connect to a server. Pass: * * * Socket type * * Host name * * Port * * Interface Specification of the Server World * * Local World to share back to the server (if any) * * Eg. * * # Connect on IPv4 to 'shoenix.org' port 5822, not sharing a world * # back to the server * * conn = Irmo.connect('IPV4', 'shoenix.org', 5822, ifspec, nil) * * # Connect on IPv6 to 'irmoroids.foo.com' port 8719, sharing a world * # back to the server * * conn = Irmo.connect('IPV6', 'irmoroids.foo.com', 8719, ifspec, * local_world) */ static VALUE connection_connect(VALUE klass, VALUE family, VALUE location, VALUE port, VALUE spec, VALUE world) { IrmoConnection *conn; VALUE wrapped_conn; conn = irmo_connect(socket_parse_addrfamily(family), STR2CSTR(location), NUM2INT(port), unwrap_ifspec(spec), unwrap_world(world)); if (!conn) rb_raise(rb_eNameError, "%s", irmo_error_get()); wrapped_conn = wrap_connection(conn); irmo_connection_unref(conn); return wrapped_conn; }