[Issue 2835] std.socket.TcpSocket.connect doesn't actually connect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 15 19:03:30 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2835





------- Comment #3 from unknown at simplemachines.org  2009-04-15 21:03 -------
Created an attachment (id=324)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=324&action=view)
Set sin_family properly.

Pruning down some C-style socket code, I determined that sin_family was the
deciding factor on this behavior.  Unfortunately, it is unclear to me why this
would've regressed from 2.026 (since sin_family has never been set?)

Graham, you can work around this issue and verify the fix by recompiling phobos
or by writing a subclass for InternetAddress, e.g.:

---
import std.c.linux.socket, core.sys.posix.sys.socket;
import std.socket;

class MyInternetAddress: InternetAddress
{
        this(string addr, ushort port)
        {
                sin.sin_family = AddressFamily.INET;
                super(addr, port);
        }

        this(uint addr, ushort port)
        {
                sin.sin_family = AddressFamily.INET;
                super(addr, port);
        }

        this(ushort port)
        {
                sin.sin_family = AddressFamily.INET;
                super(port);
        }
}
---

If you could verify this fixes your issue, it would be appreciated.

Thanks,
-[Unknown]


-- 



More information about the Digitalmars-d-bugs mailing list