815
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1999 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
818
|
14 |
SocketAddress variableByteSubclass:#AppletalkSocketAddress
|
|
15 |
instanceVariableNames:'port'
|
815
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'OS-Sockets'
|
|
19 |
!
|
|
20 |
|
|
21 |
!AppletalkSocketAddress class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
|
|
36 |
!
|
|
37 |
|
|
38 |
documentation
|
|
39 |
"
|
|
40 |
Instances of AppletalkSocketAddress represent appletalk socket addresses.
|
|
41 |
These consist of a network (2 bytes), a node (1 byte) and a port number.
|
|
42 |
|
|
43 |
|
|
44 |
[author:]
|
|
45 |
Claus Gittinger (cg@exept)
|
|
46 |
|
|
47 |
[see also:]
|
|
48 |
|
|
49 |
[instance variables:]
|
|
50 |
|
|
51 |
[class variables:]
|
|
52 |
"
|
|
53 |
! !
|
|
54 |
|
818
|
55 |
!AppletalkSocketAddress class methodsFor:'instance creation'!
|
|
56 |
|
|
57 |
new
|
|
58 |
^ self new:3
|
|
59 |
! !
|
|
60 |
|
815
|
61 |
!AppletalkSocketAddress class methodsFor:'queries'!
|
|
62 |
|
|
63 |
hostAddressByName: hostName
|
|
64 |
^ Socket appletalkAddressOfHost:hostName
|
|
65 |
|
|
66 |
"
|
|
67 |
AppletalkSocketAddress hostAddressByName:'clam'
|
|
68 |
AppletalkSocketAddress hostAddressByName:'foobar'
|
|
69 |
"
|
|
70 |
|
|
71 |
|
|
72 |
!
|
|
73 |
|
|
74 |
hostNameByAddress:anAddress
|
|
75 |
^ Socket hostWithAppletalkAddress:anAddress
|
|
76 |
|
|
77 |
"
|
|
78 |
AppletalkSocketAddress hostNameByAddress:#[1 2 3].
|
|
79 |
"
|
|
80 |
|
|
81 |
! !
|
|
82 |
|
818
|
83 |
!AppletalkSocketAddress methodsFor:'accessing'!
|
815
|
84 |
|
|
85 |
net
|
818
|
86 |
^ ((self at:1) bitShift:8) bitOr:(self at:2)
|
815
|
87 |
|
|
88 |
|
|
89 |
!
|
|
90 |
|
|
91 |
net:aNodeAddress
|
818
|
92 |
self at:1 put:((aNodeAddress bitShift:-1) bitAnd:16rFF).
|
|
93 |
self at:2 put:(aNodeAddress bitAnd:16rFF).
|
|
94 |
|
|
95 |
"
|
|
96 |
self new net:16r1234
|
|
97 |
"
|
|
98 |
!
|
|
99 |
|
|
100 |
net:netNr node:nodeNr port:portNr
|
|
101 |
self
|
|
102 |
net:netNr;
|
|
103 |
node:nodeNr;
|
|
104 |
port:portNr
|
|
105 |
|
|
106 |
"
|
|
107 |
AppletalkSocketAddress new net:1234 node:10 port:20
|
|
108 |
"
|
|
109 |
"
|
|
110 |
AppletalkSocketAddress hostAddress:#[1 2 3] port:10
|
|
111 |
"
|
|
112 |
!
|
|
113 |
|
|
114 |
node
|
|
115 |
^ self at:3
|
815
|
116 |
|
|
117 |
|
|
118 |
!
|
|
119 |
|
818
|
120 |
node:aNodeNr
|
|
121 |
self at:3 put:aNodeNr
|
815
|
122 |
|
|
123 |
|
|
124 |
!
|
|
125 |
|
|
126 |
port
|
|
127 |
^ port
|
|
128 |
|
|
129 |
!
|
|
130 |
|
818
|
131 |
port:aPortNr
|
|
132 |
port := aPortNr
|
|
133 |
|
|
134 |
! !
|
|
135 |
|
|
136 |
!AppletalkSocketAddress methodsFor:'printing & storing'!
|
|
137 |
|
|
138 |
printOn:aStream
|
|
139 |
"append a user printed representation of the receiver to aStream.
|
|
140 |
The format is suitable for a human - not meant to be read back."
|
|
141 |
|
|
142 |
self net printOn:aStream.
|
|
143 |
aStream nextPut:$:.
|
|
144 |
self node printOn:aStream.
|
|
145 |
port notNil ifTrue:[
|
|
146 |
aStream nextPut:$:.
|
|
147 |
port printOn:aStream.
|
|
148 |
].
|
|
149 |
|
|
150 |
|
|
151 |
! !
|
|
152 |
|
|
153 |
!AppletalkSocketAddress methodsFor:'queries'!
|
|
154 |
|
|
155 |
hostName
|
|
156 |
^ Socket hostWithAppletalkAddress:self
|
|
157 |
|
|
158 |
|
|
159 |
!
|
|
160 |
|
815
|
161 |
portOrName
|
|
162 |
^ port
|
|
163 |
|
|
164 |
! !
|
|
165 |
|
|
166 |
!AppletalkSocketAddress class methodsFor:'documentation'!
|
|
167 |
|
|
168 |
version
|
818
|
169 |
^ '$Header: /cvs/stx/stx/libbasic2/AppletalkSocketAddress.st,v 1.2 1999-09-21 00:27:14 cg Exp $'
|
815
|
170 |
! !
|