www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14611] New: socket.localAddress fails on Unix Sockets with

https://issues.dlang.org/show_bug.cgi?id=14611

          Issue ID: 14611
           Summary: socket.localAddress fails on Unix Sockets with longer
                    Path (> 13 characters)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: dragoscarp gmail.com

import std.file;
import std.stdio;
import std.socket;

void main()
{
    string unixSocketNameOk = "1234567890123";
    auto sOk = new Socket(AddressFamily.UNIX, SocketType.STREAM);

    sOk.bind(new UnixAddress(unixSocketNameOk));
    scope (exit) remove(unixSocketNameOk);

    writeln(sOk.localAddress);

    string unixSocketNameFail = "12345678901234";
    auto sFail = new Socket(AddressFamily.UNIX, SocketType.STREAM);

    sFail.bind(new UnixAddress(unixSocketNameFail));
    scope (exit) remove(unixSocketNameFail);

    writeln(sFail.localAddress);
}

Output:
 localhost:1234567890123
 std.socket.SocketParameterException std/socket.d(2894): Not enough socket
address storage
--
May 20 2015