[zeromq-dev] IPC REQ/REP socket unavailable to other users?
ph at imatix.com
Wed Aug 11 22:02:57 CEST 2010
Very nice... Would you like to post an issue to the bug tracker at
http://github.com/zeromq/zeromq2/issues, and post your code on
gist.github.com so that we don't lose this?
It'd be great to at least solve this for Linux and then allow people
to experiment on other platforms.
On Wed, Aug 11, 2010 at 9:12 PM, Stewart Douglas <sdouglas at snowgold.com> wrote:
> Have just done a quick test and had no issues connecting to an anonymous UDS
> created by an another user.
> The code I'm talking about sets up the socket for a connect or bind as shown
> below having first called socket in the normal way.
> struct sockaddr_un address;
> bzero(&address, sizeof(address));
> address.sun_family = AF_UNIX;
> strncpy(address.sun_path, localSocketName.c_str(),
> int length = sizeof(address.sun_family) + strlen(address.sun_path);
> // make sure we use an abstract name for the socket
> address.sun_path = 0;
> if (::connect(theSocketFD, (struct sockaddr *)&address, length))
> Presumably this could be changed in ipc.cpp, but not sure of the
> implications for decoding the addresses passed in etc. And how applicable
> this trick is across non Linux platforms. My copy of Stevens is silent on
> the matter, or I am too tired to find the correct page. Also I think length
> could be calculated simply from sizeof(address).
> int zmq::resolve_local_path (sockaddr_storage *addr_, socklen_t *addr_len_,
> const char *path_)
> Hope this is some help
> On 11/08/10 17:23, Pieter Hintjens wrote:
> On Wed, Aug 11, 2010 at 6:22 PM, Stewart Douglas <sdouglas at snowgold.com>
> Nope can use them between different processes for sure, not talking about
> socket pair but socket then bind or connect. Pass in a sockaddr_un to
> connect or bind and make sure the first char of address.sun_path is 0 - best
> to do this after the strncpy of course ;-> Can dig out example code when I
> get home - but need to check that it does avoid the permissions issue. Also
> may be Linux specific
> That'd be great...!
> Stewart Douglas
> sdouglas at snowgold.com
More information about the zeromq-dev