Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 1548

Show
Ignore:
Timestamp:
05/23/10 23:40:02 (15 years ago)
Author:
rsinfu
Message:

Fixed bugzilla 2835: std.socket.TcpSocket? doesn't actually connect.
Merged from trunk; see r1543.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/phobos-1.x/phobos/std/socket.d

    r1539 r1548  
    686686                uint uiaddr = parse(addr); 
    687687                if(ADDR_NONE == uiaddr) 
    688688                { 
    689689                        InternetHost ih = new InternetHost; 
    690690                        if(!ih.getHostByName(addr)) 
    691691                                //throw new AddressException("Invalid internet address"); 
    692692                            throw new AddressException( 
    693693                                 "Unable to resolve host '" ~ addr ~ "'"); 
    694694                        uiaddr = ih.addrList[0]; 
    695695                } 
     696                sin.sin_family = AddressFamily.INET; 
    696697                sin.sin_addr.s_addr = htonl(uiaddr); 
    697698                sin.sin_port = htons(port); 
    698699        } 
    699700 
    700701        /** 
    701702         * Construct a new Address. addr may be ADDR_ANY (default) and port may 
    702703         * be PORT_ANY, and the actual numbers may not be known until a connection 
    703704         * is made. 
    704705         */ 
    705706        this(uint addr, ushort port) 
    706707        { 
     708                sin.sin_family = AddressFamily.INET; 
    707709                sin.sin_addr.s_addr = htonl(addr); 
    708710                sin.sin_port = htons(port); 
    709711        } 
    710712 
    711713        /// ditto 
    712714        this(ushort port) 
    713715        { 
     716                sin.sin_family = AddressFamily.INET; 
    714717                sin.sin_addr.s_addr = 0; //any, "0.0.0.0" 
    715718                sin.sin_port = htons(port); 
    716719        } 
    717720 
    718721        /// Human readable string representing the IPv4 address in dotted-decimal form. 
    719722        string toAddrString() 
    720723        { 
    721724                return std.string.toString(inet_ntoa(sin.sin_addr)).dup; 
    722725        } 
    723726