Class: NNG::Socket::Pull0
- Inherits:
-
Object
- Object
- NNG::Socket::Pull0
- Defined in:
- ext/rbnng/pull0.c
Instance Method Summary collapse
Constructor Details
#initialize ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'ext/rbnng/pull0.c', line 11
static VALUE
socket_pull0_initialize(VALUE self)
{
RbnngSocket* p_rbnngSocket;
Data_Get_Struct(self, RbnngSocket, p_rbnngSocket);
int rv;
if ((rv = nng_pull0_open(&p_rbnngSocket->socket)) != 0) {
raise_error(rv);
return Qnil;
}
return self;
}
|
Instance Method Details
#get_msg ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'ext/rbnng/socket.c', line 39
VALUE
socket_get_msg(VALUE self)
{
RbnngSocket* p_rbnngSocket;
Data_Get_Struct(self, RbnngSocket, p_rbnngSocket);
int rv =
rb_thread_call_without_gvl(socket_get_msg_blocking, p_rbnngSocket, 0, 0);
if (rv == 0) {
RbnngMsg* p_newMsg;
VALUE newMsg = rb_class_new_instance(0, 0, rbnng_MsgClass);
Data_Get_Struct(newMsg, RbnngMsg, p_newMsg);
p_newMsg->p_msg = p_rbnngSocket->p_getMsgResult;
return newMsg;
} else {
raise_error(rv);
return Qnil;
}
}
|
#listen(url) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'ext/rbnng/socket.c', line 114
VALUE
socket_listen(VALUE self, VALUE url)
{
Check_Type(url, T_STRING);
RbnngSocket* p_rbnngSocket;
Data_Get_Struct(self, RbnngSocket, p_rbnngSocket);
int rv;
if ((rv = nng_listen(p_rbnngSocket->socket, StringValueCStr(url), NULL, 0)) !=
0) {
raise_error(rv);
}
}
|