SocketAddress.st
author Claus Gittinger <cg@exept.de>
Wed, 09 Jul 2003 16:26:27 +0200
changeset 1259 0a557e59ea4a
parent 1232 49ce4681f1c0
child 1262 d3daddd36a99
permissions -rw-r--r--
instance creation refactored (dispatch from Socket via peerFromDomain:name:port:)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    13
"{ Package: 'stx:libbasic2' }"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    14
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
    15
UninterpretedBytes variableByteSubclass:#SocketAddress
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    16
	instanceVariableNames:''
1229
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    17
	classVariableNames:'DomainToClassMapping'
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    18
	poolDictionaries:''
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    19
	category:'OS-Sockets'
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!SocketAddress class methodsFor:'documentation'!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	      All Rights Reserved
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    40
    Abstract superclass for subclasses implementing various IPC addressing schemes.
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    41
    See concrete examples IPSocketAddress and UDSocketAddress.
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    42
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    ST-80 compatibility class.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    This may be required when existing code has to be ported to ST/X;
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    however, it may not be complete and more protocol may be added in the future.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    The code here was created when public domain code (Manchester) had to
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    be ported to ST/X and missing classes/methods were encountered, and code added
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    by reasoning 'what the original class could probably do there'.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    This is an additional goody class; therefore:
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    SUCH DAMAGE.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    66
!SocketAddress class methodsFor:'instance creation'!
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    67
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    68
hostAddress:addr
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    69
    "get a new instance given addr-bytes"
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    70
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    71
    ^ self hostAddress:addr port:0
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    72
!
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    73
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    74
hostAddress:addr port:portNr
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    75
    "get a new instance given addr-bytes and a portNr"
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    76
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    77
    ^ self new hostAddress:addr; port:portNr
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    78
!
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    79
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    80
hostName:name
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    81
    "get a new instance given a hostname"
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    82
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    83
    ^ self hostName:name serviceName:nil type:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    84
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    85
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    86
hostName:name port:portNr
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    87
    "get a new instance given a hostname and port"
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    88
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    89
    ^ self hostName:name serviceName:portNr type:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    90
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    91
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    92
hostName:name serviceName:portNrOrName type:socketTypeSymbol
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
    93
    "get a new instance given a hostname, port or service and type"
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    94
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    95
    |addressInfo serviceName port sa|
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    96
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    97
    portNrOrName isString ifTrue:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    98
        serviceName := portNrOrName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    99
    ] ifFalse:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   100
        port := portNrOrName.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   101
    ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   102
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   103
    addressInfo := self 
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   104
                    getAddressInfo:name 
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   105
                    serviceName:serviceName 
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   106
                    domain:(self domainSymbol) 
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   107
                    type:socketTypeSymbol
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   108
                    protocol:nil 
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   109
                    flags:0.
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   110
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   111
    sa := addressInfo first socketAddress.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   112
    addressInfo size > 1 ifTrue:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   113
        (addressInfo contains:[:entry| entry socketAddress ~= sa]) ifTrue:[
1232
49ce4681f1c0 dont wine if we get multiple host addresses for a name
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   114
            'SocketAddress [warning]: multiple hostAddresses for host' infoPrintCR.
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   115
        ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   116
    ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   117
    port notNil ifTrue:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   118
        sa port:port.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   119
    ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   120
    ^ sa
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   121
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   122
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   123
     SocketAddress hostName:'localhost' serviceName:10 type:#stream
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   124
     IPSocketAddress hostName:'localhost' serviceName:'echo' type:#datagram 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   125
     IPSocketAddress hostName:'localhost' serviceName:'echo' type:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   126
    "
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   127
!
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   128
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   129
new
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   130
    |numBytes|
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   131
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   132
    self == SocketAddress ifTrue:[
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   133
        self error:'SocketAddress is abstract'.
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   134
    ].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   135
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   136
    numBytes := self socketAddressSize.
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   137
    numBytes isNil ifTrue:[
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   138
        self error:'unsupported domain'.
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   139
        ^ nil
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   140
    ].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   141
    ^ (self new:numBytes) domainCode:(self domainCode)
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   142
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   143
    "
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   144
     IPSocketAddress new            
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   145
     IPv6SocketAddress new          
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   146
     UDSocketAddress new            
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   147
     AppletalkSocketAddress new
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   148
   "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   149
!
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   150
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   151
newDomain:domain
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   152
   "answer an new socket address for a given domain"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   153
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   154
   ^ (self knownClassFromCode:domain) new
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   155
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   156
   "
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   157
    self newDomain:#afUnix    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   158
    self newDomain:#afInet    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   159
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   160
    self newDomain:#'AF_UNIX' 
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   161
    self newDomain:#'AF_INET' 
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   162
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   163
    self newDomain:#unix
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   164
    self newDomain:#inet
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   165
   "
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   166
!
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   167
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   168
peerName:peerName port:port
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   169
    self error:'unsupported domain'.
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   170
! !
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   171
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
!SocketAddress class methodsFor:'queries'!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   174
domainCode
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   175
    "answer the numerical domain code used in socket addresses"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   176
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   177
    ^ OperatingSystem socketAccessor domainCodeOf:self domainSymbol
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   178
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   179
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
domainCodeFromName:aNameSymbol
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   181
    "this is a compatibility method;
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   182
     VW returns the internal unix codes here - however, in ST/X,
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   183
     symbols are returned, which are translated later"
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   184
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   185
    aNameSymbol == #afUnix      ifTrue:[^ #'AF_UNIX'].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   186
    aNameSymbol == #afInet      ifTrue:[^ #'AF_INET'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   187
    aNameSymbol == #afIpV6      ifTrue:[^ #'AF_INET6'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   188
    aNameSymbol == #afAppletalk ifTrue:[^ #'AF_APPLETALK'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   189
    aNameSymbol == #afDecnet    ifTrue:[^ #'AF_DECnet'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   190
    aNameSymbol == #afSna       ifTrue:[^ #'AF_SNA'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   191
    aNameSymbol == #afNs        ifTrue:[^ #'AF_NS'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   192
    aNameSymbol == #afCcitt     ifTrue:[^ #'AF_CCITT'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   193
    aNameSymbol == #afImplink   ifTrue:[^ #'AF_IMPLINK'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   194
    aNameSymbol == #afPup       ifTrue:[^ #'AF_PUP'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   195
    aNameSymbol == #afChaos     ifTrue:[^ #'AF_CHAOS'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   196
    aNameSymbol == #afEcma      ifTrue:[^ #'AF_ECMA'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   197
    aNameSymbol == #afDatakit   ifTrue:[^ #'AF_DATAKIT'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   198
    aNameSymbol == #afDli       ifTrue:[^ #'AF_DLI'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   199
    aNameSymbol == #afLat       ifTrue:[^ #'AF_LAT'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   200
    aNameSymbol == #afHylink    ifTrue:[^ #'AF_HYLINK'].    
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   201
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   202
    aNameSymbol == #afUnspec    ifTrue:[^ #'AF_UNSPEC'].    
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   203
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    "/
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    "/ could someone tell me which symbols are used in ST-80's SocketAddress class ?
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    "/
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    self error:'no more mimicri implemented yet ...'
602
b7afbf8a1589 Support #afInet.
Stefan Vogel <sv@exept.de>
parents: 488
diff changeset
   208
b7afbf8a1589 Support #afInet.
Stefan Vogel <sv@exept.de>
parents: 488
diff changeset
   209
    "Modified: / 9.1.1998 / 10:03:56 / stefan"
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   210
!
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   211
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   212
domainNameFromCode:code
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   213
    "this is a compatibility method;
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   214
     VW expects the internal unix codes here - however, in ST/X,
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   215
     symbols are expected - keeping the numeric values secret (in Socket)"
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   216
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   217
    code == #unix           ifTrue:[^ #afUnix].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   218
    code == #'AF_UNIX'      ifTrue:[^ #afUnix].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   219
    code == #inet           ifTrue:[^ #afInet].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   220
    code == #'AF_INET'      ifTrue:[^ #afInet].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   221
    code == #inet6          ifTrue:[^ #afIpV6].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   222
    code == #'AF_INET6'     ifTrue:[^ #afIpV6].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   223
    code == #appletalk      ifTrue:[^ #afAppletalk].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   224
    code == #'AF_APPLETALK' ifTrue:[^ #afAppletalk].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   225
    code == #DECnet         ifTrue:[^ #afDecnet].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   226
    code == #'AF_DECNET'    ifTrue:[^ #afDecnet].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   227
    code == #sna            ifTrue:[^ #afSna].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   228
    code == #'AF_SNA'       ifTrue:[^ #afSna].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   229
    code == #xns            ifTrue:[^ #afNs].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   230
    code == #'AF_NS'        ifTrue:[^ #afNs].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   231
    code == #ccitt          ifTrue:[^ #afCcitt].
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   232
    code == #'AF_CCITT'     ifTrue:[^ #afCcitt].
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   233
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   234
    "/
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   235
    "/ could someone tell me which symbols are used in ST-80's SocketAddress class ?
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   236
    "/
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   237
    self error:'no more mimicri implemented yet ...'
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   238
!
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   239
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   240
domainSymbol
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   241
    "answer the domain symbol. Subclasses redefine this"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   242
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   243
    self == SocketAddress ifTrue:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   244
        ^ nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   245
    ] ifFalse:[
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   246
        self subclassResponsibility
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   247
    ]
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   248
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   249
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   250
getAddressInfo:hostName serviceName:serviceName domain:domainArg type:typeArg protocol:protoArg flags:flags 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   251
    "answer an Array of socket addresses for serviceName on hostName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   252
     Domain, type, protocol may be nil or specify a hint for the socket 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   253
     addresses to be returned."
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   254
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   255
    ^ OperatingSystem socketAccessor 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   256
            getAddressInfo:hostName serviceName:serviceName 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   257
            domain:domainArg type:typeArg protocol:protoArg flags:flags 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   258
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   259
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   260
     self getAddressInfo:'localhost' serviceName:nil 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   261
            domain:nil type:nil protocol:nil flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   262
     self getAddressInfo:'localhost' serviceName:nil 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   263
            domain:#inet type:#stream protocol:nil flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   264
     self getAddressInfo:'localhost' serviceName:nil 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   265
            domain:#inet type:#stream protocol:#tcp flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   266
     self getAddressInfo:'blurb.exept.de' serviceName:nil 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   267
            domain:#inet type:nil protocol:nil flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   268
     self getAddressInfo:'1.2.3.4' serviceName:'6' 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   269
            domain:#inet type:nil protocol:nil flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   270
     self getAddressInfo:'localhost' serviceName:'echo' 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   271
            domain:#inet6 type:nil protocol:nil flags:nil
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   272
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   273
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   274
1167
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   275
getAddressInfo:hostName serviceName:serviceName type:typeArg protocol:protoArg flags:flags 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   276
    "answer an Array of socket addresses for serviceName on hostName
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   277
     Domain, type, protocol may be nil or specify a hint for the socket 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   278
     addresses to be returned."
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   279
1232
49ce4681f1c0 dont wine if we get multiple host addresses for a name
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   280
    ^ self  
49ce4681f1c0 dont wine if we get multiple host addresses for a name
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   281
        getAddressInfo:hostName serviceName:serviceName 
49ce4681f1c0 dont wine if we get multiple host addresses for a name
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   282
        domain:(self domainCode) type:typeArg protocol:protoArg flags:flags 
1167
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   283
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   284
    "
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   285
     IPSocketAddress getAddressInfo:'localhost' serviceName:nil 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   286
                     type:nil protocol:nil flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   287
     IPSocketAddress getAddressInfo:'localhost' serviceName:nil 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   288
                     type:#stream protocol:nil flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   289
     IPSocketAddress getAddressInfo:'localhost' serviceName:nil 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   290
                     type:#stream protocol:#tcp flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   291
     IPSocketAddress getAddressInfo:'blurb.exept.de' serviceName:nil 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   292
                     type:nil protocol:nil flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   293
     IPSocketAddress getAddressInfo:'1.2.3.4' serviceName:'6' 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   294
                     type:nil protocol:nil flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   295
     IPSocketAddress getAddressInfo:'localhost' serviceName:'echo' 
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   296
                     type:nil protocol:nil flags:nil
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   297
    "
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   298
!
56c172bc5cfe Category change
Stefan Vogel <sv@exept.de>
parents: 1164
diff changeset
   299
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   300
getNameInfo:socketAddress wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   301
    "answer an Array containing the hostName and serviceName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   302
     in socketAddress. SocketType may be one "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   303
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   304
    ^ OperatingSystem socketAccessor
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   305
            getNameInfo:socketAddress wantHostName:wantHostName 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   306
            wantServiceName:wantServiceName datagram:useDatagram flags:flags 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   307
    
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   308
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   309
     self getNameInfo:
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   310
         (self getAddressInfo:'localhost' serviceName:'echo' 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   311
                domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   312
         wantHostName:true wantServiceName:true datagram:false flags:0
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   313
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   314
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   315
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   316
knownClassFromCode:code
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   317
    "this is a compatibility method;
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   318
     VW expects the internal unix codes here - however, in ST/X,
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   319
     symbols are expected - keeping the numeric values secret (in Socket)"
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   320
1229
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   321
    |cls|
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   322
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   323
    DomainToClassMapping isNil ifTrue:[
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   324
        DomainToClassMapping := IdentityDictionary new
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   325
    ].
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   326
    cls := DomainToClassMapping at:code ifAbsent:nil.
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   327
    cls notNil ifTrue:[^ cls].
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   328
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   329
    code notNil ifTrue:[
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   330
        "/ some are always known...
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   331
        DomainToClassMapping at:#unix put:UDSocketAddress.
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   332
        DomainToClassMapping at:#inet put:IPSocketAddress.
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   333
        DomainToClassMapping at:#inet6 put:IPv6SocketAddress.
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   334
        DomainToClassMapping at:#appletalk put:AppletalkSocketAddress.
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   335
        DomainToClassMapping at:#decnet put:DecNetSocketAddress.
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   336
1229
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   337
        self allSubclassesDo:[:aSubClass|
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   338
            (aSubClass domainCode == code
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   339
            or:[aSubClass domainSymbol == code
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   340
            or:[aSubClass obsoleteDomainSymbol == code
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   341
            or:[aSubClass vwDomainSymbol == code]]])
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   342
            ifTrue:[
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   343
                DomainToClassMapping at:code put:aSubClass.
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   344
                ^ aSubClass
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   345
            ].
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   346
        ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   347
    ].
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   348
    ^ SocketAddress
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   349
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   350
    "
1229
b96b65284981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   351
     self knownClassFromCode:#'AF_UNIX' 
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   352
     self knownClassFromCode:#'AF_INET'
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   353
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   354
     self knownClassFromCode:1
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   355
     self knownClassFromCode:2
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   356
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   357
     self knownClassFromCode:#unix             obsolete ST/X codes
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   358
     self knownClassFromCode:#inet
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   359
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   360
     self knownClassFromCode:#afUnix           visualWorks codes
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   361
     self knownClassFromCode:#afInet
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   362
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   363
!
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   364
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   365
obsoleteDomainSymbol
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   366
    ^ nil
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   367
!
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   368
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   369
peerNameFromPeer:peer
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   370
    ^ peer hostName
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   371
!
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   372
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   373
socketAddressSize
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   374
    "answer the OS specific size of a socket address"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   375
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   376
    ^ OperatingSystem socketAccessor socketAddressSize:(self domainSymbol)
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   377
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   378
    "
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   379
     UDSocketAddress socketAddressSize
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   380
     IPSocketAddress socketAddressSize  
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   381
     IPv6SocketAddress socketAddressSize
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   382
     AppletalkSocketAddress socketAddressSize  
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   383
     DecNetSocketAddress socketAddressSize     
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   384
    "
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   385
!
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   386
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   387
vwDomainSymbol
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
   388
    ^ nil
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   391
!SocketAddress methodsFor:'accessing'!
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   392
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   393
domainCode
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   394
    ^ self unsignedShortAt:1
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   395
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   396
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   397
domainCode:anInteger
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   398
    self unsignedShortAt:1 put:anInteger
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   399
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   400
1223
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   401
hostAddress:addressBytes
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   402
    "generic method, subclasses usually redefine this"
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   403
1223
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   404
    "/ the first 2-bytes (a short) is the domainCode
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   405
    self replaceBytesFrom:1+2 to:addressBytes size+2 with:addressBytes startingAt:1
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   406
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   407
    "
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   408
     IPSocketAddress hostAddress:#[193 141 12 193] port:80
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   409
    "
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   410
!
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   411
1223
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   412
hostAddress:addressBytes port:portNr
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   413
    self hostAddress:addressBytes.
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   414
    self port:portNr
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   415
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   416
    "
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   417
     IPSocketAddress hostAddress:#[193 141 12 193] port:10
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   418
    "
1223
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   419
!
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   420
1223
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   421
port
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   422
    self subclassResponsibility
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   423
!
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   424
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   425
port:portNr
24b2821edf3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   426
    self subclassResponsibility
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   427
! !
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   428
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   429
!SocketAddress methodsFor:'printing & storing'!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   430
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   431
displayString
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   432
    "redefine from Collection"
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   433
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   434
    |s|
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   435
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   436
    s := WriteStream on:''.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   437
    self printOn:s.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   438
    ^ s contents.
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   439
! !
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   440
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   441
!SocketAddress methodsFor:'private'!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   442
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   443
fromBytes:aByteArray
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   444
    "Copy the internal representation of a SocketAddress to myself
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   445
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   446
     This is an internal interface!!"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   447
1225
8839f52dde96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
   448
    self replaceBytesFrom:1 to:(self size) with:aByteArray startingAt:1.
8839f52dde96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
   449
8839f52dde96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
   450
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   451
! !
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   452
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
!SocketAddress methodsFor:'queries'!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   455
address
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   456
    ^ self subclassResponsibility
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   457
!
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   458
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   459
hostName
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   460
    ^ (self class getNameInfo:self wantHostName:true 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   461
                  wantServiceName:false datagram:false flags:0) first
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   462
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   463
    "
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   464
     (IPSocketAddress hostAddress:#[127 0 0 1]) hostName        
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   465
     (IPSocketAddress hostName:'localhost') address        
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   466
     (IPSocketAddress hostName:'www.google.com') address        
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   467
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   468
     (IPSocketAddress hostAddress:#[127 0 0 1] port:7) hostName        
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   469
     (IPSocketAddress hostAddress:#[193 141 12 193] port:10) hostName  
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   470
     (IPSocketAddress hostAddress:#[193 141 12 244]) hostName 
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   471
    "
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   472
!
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   473
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
portOrName
210
d940e6a66526 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   475
    ^ self subclassResponsibility
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   476
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   477
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   478
serviceName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   479
    ^ (self class getNameInfo:self wantHostName:false 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   480
                  wantServiceName:true datagram:false flags:0) second
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   481
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   482
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   483
     (IPSocketAddress hostAddress:#[127 0 0 1] port:7) serviceName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   484
     (IPSocketAddress hostAddress:#[193 141 12 193] port:10) serviceName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   485
    "
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   488
!SocketAddress class methodsFor:'documentation'!
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   489
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   490
version
1259
0a557e59ea4a instance creation refactored
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   491
    ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.18 2003-07-09 14:26:06 cg Exp $'
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
   492
! !