ezmq icon indicating copy to clipboard operation
ezmq copied to clipboard

No pull socket?

Open matrixise opened this issue 11 years ago • 5 comments
trafficstars

I try to use a pull socket with ezmq, but I get an error saying there is an error in the socket_type.

#! /usr/bin/env escript
%%! -pa deps/ezmq/ebin -Wall debug verbose

main(_) ->
    {ok, Socket} = ezmq:start([{type, pull}]),
    ezmq:connect(Socket, {127, 0, 0, 1}, 5558, []),
    loop(Socket, 0),

    ok = ezmq:close(Socket).

loop(_Socket, 10) ->
    ok;

loop(Socket, N) ->
    {ok, Request} = ezmq:recv(Socket),
    io:format("Received '~s' ~w~n", [Request, N]),
    loop(Socket, N+1).
escript: exception error: no match of right hand side value {error,invalid_opts}

matrixise avatar Feb 15 '14 07:02 matrixise

Only req, rep, router, dealer, sub and pub are implemented at the moment.

Locking at the zeromq docs, it seems that dealer is the closest similar behavior. Could you use that as temporary alternative?

BTW: building ezmq_socket_push.erl and ezmq_socket_pull.erl wouldn't take much, but my dev-system is currently down :-(

RoadRunnr avatar Feb 16 '14 14:02 RoadRunnr

Yes, you can use dealer as substitute for pull or push. Dealer is in fact identical to the two combined (bidirectional, where pull and push restrict flow to one direction each).

On Sun, Feb 16, 2014 at 3:47 PM, Andreas Schultz [email protected]:

Only req, rep, router, dealer, sub and pub are implemented at the moment.

Locking at the zeromq docs, it seems that dealer is the closest similar behavior. Could you use that as temporary alternative?

BTW: building ezmq_socket_push.erl and ezmq_socket_pull.erl wouldn't take much, but my dev-system is currently down :-(

Reply to this email directly or view it on GitHubhttps://github.com/zeromq/ezmq/issues/5#issuecomment-35198408 .

hintjens avatar Feb 16 '14 17:02 hintjens

Excuse me guys, I couldn't manage to correctly make dealer sends to a pull socket (I'm still quite new to Erlang), would you give me a clue on how to make that work ? :)

krakatoa avatar Apr 14 '14 22:04 krakatoa

Dealer can send to dealer, it's exactly the same (except biirectional).

On Tue, Apr 15, 2014 at 12:56 AM, krakatoa [email protected] wrote:

Excuse me guys, I couldn't manage to correctly send dealer sends to a pull socket (I'm still quite new to Erlang), would you give me a clue on how to make that work ? :)

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/ezmq/issues/5#issuecomment-40428166 .

hintjens avatar Apr 14 '14 22:04 hintjens

Thanks for the hint Pieter! my problem was on understanding the way to send multiple frames on the ezmq:send/2 function. I got it, and now I'm using a combination of dealer-router, sending data as ezmq:send(Socket, [<<"some-id","","message-here">>])..

krakatoa avatar Apr 15 '14 03:04 krakatoa