Exemple #1
0
void EM::Connection::Connect (const char *host, int port)
{
	Signature = evma_connect_to_server (host, port);
	#ifdef OS_SOLARIS8
	Eventables.insert( std::map<std::string,EM::Eventable*>::value_type (Signature, this));
	#else
	Eventables.insert( make_pair (Signature, this));
	#endif
}
Exemple #2
0
static VALUE t_connect_server (VALUE self, VALUE server, VALUE port)
{
	// Avoid FIX2INT in this case, because it doesn't deal with type errors properly.
	// Specifically, if the value of port comes in as a string rather than an integer,
	// NUM2INT will throw a type error, but FIX2INT will generate garbage.

	const unsigned long f = evma_connect_to_server (NULL, 0, StringValuePtr(server), NUM2INT(port));
	if (!f)
		rb_raise (rb_eRuntimeError, "no connection");
	return ULONG2NUM (f);
}
static VALUE t_bind_connect_server (VALUE self, VALUE bind_addr, VALUE bind_port, VALUE server, VALUE port)
{
    // Avoid FIX2INT in this case, because it doesn't deal with type errors properly.
    // Specifically, if the value of port comes in as a string rather than an integer,
    // NUM2INT will throw a type error, but FIX2INT will generate garbage.

    try {
        const unsigned long f = evma_connect_to_server (StringValuePtr(bind_addr), NUM2INT(bind_port), StringValuePtr(server), NUM2INT(port));
        if (!f)
            rb_raise (EM_eConnectionError, "%s", "no connection");
        return ULONG2NUM (f);
    } catch (std::runtime_error e) {
        rb_raise (EM_eConnectionError, "%s", e.what());
    }
    return Qnil;
}
Exemple #4
0
void EM::Connection::Connect (const char *host, int port)
{
	Signature = evma_connect_to_server (host, port);
	Eventables.insert( make_pair (Signature, this));
}