Hi Elias,

the idea is this:

man 7 unix says:

/abstract:  an  abstract  socket address is distinguished by the fact//
// that sun_path[0] is a null byte ('\0'). The socket's address in// // this namespace is given by the additional bytes in sun_path that are// // covered by the specified length of the address structure. (Null//
//          bytes  in  the  name have no special significance.)/

So I *memset()* the entire socket address first and then copy the name to *sun_path,* but starting at *sun_path[1]* so that *sun_path[0]* remains *0 *(making it an abstract
socket).

man 7 unix also says:

/The abstract socket namespace is a nonportable Linux extension./

That's why I *#define ABSTRACT_OFFSET* to 1 if your OS supports it and
you can change it to 0 if not. In the latter case you have to provide a file
*/tmp/GNU-APL/APserver* manually with proper permissions.

This file is having the file permissions that you were after earlier. I am
not creating that file because I expect more problems with it than benefits
(who owns it, who installs it, what if one user creates it with wrong permissions etc.).

My general feeling is that TCP on localhost is much cleaner and maybe I should make
that the default.

/// Jürgen


On 07/24/2014 12:59 PM, Elias Mårtenson wrote:
Sorry, I accidentally hit send… Here's the rest:

In the following call can be found in bot Svar_DB.ccand the APserver, you can find the following:

strcpy(remote.sun_path + ABSTRACT_OFFSET, server_sockname);

ABSTRACT_OFFSETis #defined to 1. This means that the first character of the path will be 0 (there is a memset()before), and of course the call to bind()will fail.

Removing the addition of ABSTRACT_OFFSETwill fix the problem.

I've been looking at the code and I have been trying to figure out why the code was written in this way to begin with. Any ideas?

Regards,
Elias


On 24 July 2014 18:55, Elias Mårtenson <loke...@gmail.com <mailto:loke...@gmail.com>> wrote:

    I had never been able to get APserver to work properly, and
    particularly not with the Unix Domain Sockets.

    But, I finally figured it out. :-)

    In the following call can be found in bot Svar_DB.cc and the APserver.



Reply via email to