Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow binaries to be used in bind & connect

  • Loading branch information...
commit 042a49de1b4296b3b07eb29502be5ca0cd31216b 1 parent 0faa7c1
@yrashk yrashk authored
Showing with 9 additions and 3 deletions.
  1. +1 −1  include/erlzmq.hrl
  2. +8 −2 src/erlzmq.erl
View
2  include/erlzmq.hrl
@@ -62,7 +62,7 @@
%% <i>For more information see
%% <a href="http://api.zeromq.org/master:zmq_bind">zmq_bind</a> or
%% <a href="http://api.zeromq.org/master:zmq_connect">zmq_connect</a></i>
--type erlzmq_endpoint() :: string().
+-type erlzmq_endpoint() :: string() | binary().
%% Standard error atoms.
-type errno() :: eperm | enoent | srch | eintr | eio | enxio | ebad |
View
10 src/erlzmq.erl
@@ -138,7 +138,10 @@ socket(Context, Type, {active, false}) ->
erlzmq_error().
bind({I, Socket}, Endpoint)
when is_integer(I), is_list(Endpoint) ->
- erlzmq_nif:bind(Socket, Endpoint).
+ erlzmq_nif:bind(Socket, Endpoint);
+bind({I, Socket}, Endpoint)
+ when is_integer(I), is_binary(Endpoint) ->
+ bind({I, Socket}, binary_to_list(Endpoint)).
%% @doc Connect a socket.
%% <br />
@@ -151,7 +154,10 @@ bind({I, Socket}, Endpoint)
erlzmq_error().
connect({I, Socket}, Endpoint)
when is_integer(I), is_list(Endpoint) ->
- erlzmq_nif:connect(Socket, Endpoint).
+ erlzmq_nif:connect(Socket, Endpoint);
+connect({I, Socket}, Endpoint)
+ when is_integer(I), is_binary(Endpoint) ->
+ connect({I, Socket}, binary_to_list(Endpoint)).
%% @equiv send(Socket, Msg, [])
-spec send(erlzmq_socket(),
Please sign in to comment.
Something went wrong with that request. Please try again.