Jump to page: 1 2
Thread overview
[Issue 2835] New: std.socket.TcpSocket.accept blocks forever
Apr 14, 2009
d-bugmail
Apr 14, 2009
d-bugmail
[Issue 2835] std.socket.TcpSocket.connect doesn't actually connect
Apr 15, 2009
d-bugmail
Apr 16, 2009
d-bugmail
Apr 17, 2009
d-bugmail
Dec 25, 2009
Foy Savas
Feb 05, 2010
iorlas
Feb 14, 2010
Alexey Ivanov
May 23, 2010
Shin Fujishiro
May 23, 2010
Sohgo Takeuchi
May 24, 2010
Sohgo Takeuchi
May 24, 2010
Shin Fujishiro
April 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835

           Summary: std.socket.TcpSocket.accept blocks forever
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: graham.stjack@internode.on.net


The attached code works in 2.0.26 and blocks on accept in 2.0.27


-- 

April 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835





------- Comment #1 from graham.stjack@internode.on.net  2009-04-14 16:39 -------
Created an attachment (id=322)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=322&action=view)
Test case


-- 

April 15, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835


unknown@simplemachines.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |unknown@simplemachines.org
            Summary|std.socket.TcpSocket.accept |std.socket.TcpSocket.connect
                   |blocks forever              |doesn't actually connect




------- Comment #2 from unknown@simplemachines.org  2009-04-15 12:40 -------
Just a drive-by.  Simplified testcase:

---
import std.socket, std.stdio;

void main()
{
        // Replace 12345 with any unused port.
        auto address = new InternetAddress("127.0.0.1", 12345);

        try
        {
                auto client = new TcpSocket();
                client.connect(address);

                writefln("Where's my error?");
        }
        catch (SocketException)
                writefln("Success");
}
---

Testcase succeeds on Windows, but not Linux, using 2.028 and CentOS 5.3.  Most likely, incorrect size of the sockaddr_in struct or something.

-[Unknown]


-- 

April 16, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835





------- Comment #3 from unknown@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]


-- 

April 17, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835





------- Comment #4 from graham.stjack@internode.on.net  2009-04-16 20:00 -------
It did indeed fix the issue. My (improved) test code now works in 2.026 and 2.028 when I use the workaround.


-- 

December 25, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2835


Foy Savas <foysavas@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |foysavas@gmail.com


--- Comment #5 from Foy Savas <foysavas@gmail.com> 2009-12-24 19:48:56 PST ---
I can confirm this patch applying cleanly to the latest Phobos. Can we get this in for the next DMD release? It's no exaggeration to say that working sockets to some are both their bread and butter.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2835


iorlas <denis.tomilin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |4ybaka@gmail.com


--- Comment #6 from iorlas <denis.tomilin@gmail.com> 2010-02-05 15:46:27 PST ---
*** Issue 3649 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2835



--- Comment #7 from Alexey Ivanov <aifgi90@gmail.com> 2010-02-14 07:18:56 PST ---
Created an attachment (id=567)
patch for std.socket

Patch for std.socket

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2835


Shin Fujishiro <rsinfu@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #8 from Shin Fujishiro <rsinfu@gmail.com> 2010-05-23 01:34:23 PDT ---
Fixed in svn r1543.
Thanks for the patches!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2835


Sohgo Takeuchi <sohgo@sohgo.dyndns.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sohgo@sohgo.dyndns.org


--- Comment #9 from Sohgo Takeuchi <sohgo@sohgo.dyndns.org> 2010-05-23 02:43:15 PDT ---
Phobos1 has the same problem.
I am happy that this fix will be applied to the phobos1 too.
Thanks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2