Changeset 648 for trunk/ab5.0


Ignore:
Timestamp:
Oct 18, 2008, 10:22:52 PM (16 years ago)
Author:
OverTaker
Message:

IPEndPointの実装

Location:
trunk/ab5.0/ablib/src/Classes/System/Net
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Net/IPAddress.ab

    r647 r648  
    4040        item = malloc(size)
    4141        memcpy(item, VarPtr(ip), size)
     42    End Sub
     43
     44    /*!
     45    @brief コンストラクタ
     46    @param SocketAddressクラスから作成
     47    @note  このコンストラクタはライブラリ内のみで使用する目的で作られています。
     48    */
     49    Sub IPAddress(address As SocketAddress)
     50        family = address.AddressFamily
     51        Select Case family
     52            Case AF_INET
     53                Dim addr4 = address.Items As *sockaddr_in
     54                size = SizeOf(in_addr)
     55                item = malloc(size)
     56                memcpy(item, VarPtr(addr4->sin_addr.s_addr), size)
     57            Case AF_INET6
     58                Dim addr6 = address.Items As *sockaddr_in6
     59                size = SizeOf(in6_addr)
     60                item = malloc(size)
     61                memcpy(item, VarPtr(addr6->sin6_addr.s6_addr), size)
     62            Case Else
     63                Throw New NotSupportedException("IPAddress: Not Supported AddressFamily.")
     64        End Select
    4265    End Sub
    4366
  • trunk/ab5.0/ablib/src/Classes/System/Net/SocketAddress.ab

    r647 r648  
    4444    */
    4545    Sub ~SocketAddress()
    46         free(item)
     46        If item <> NULL Then free(item)
    4747    End Sub
    4848
Note: See TracChangeset for help on using the changeset viewer.