[squeak-dev] The Inbox: Network-nice.106.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jan 19 21:33:24 UTC 2011
A new version of Network was added to project The Inbox:
http://source.squeak.org/inbox/Network-nice.106.mcz
==================== Summary ====================
Name: Network-nice.106
Author: nice
Time: 19 January 2011, 10:33:11.624 pm
UUID: 63fe0b58-0981-40ee-ad9d-6b2d3345ff2f
Ancestors: Network-mtf.105
Use do:separatedBy: where it simplifies code.
Undo some automated but zealous _ -> := replacements
=============== Diff against Network-mtf.105 ===============
Item was changed:
----- Method: FileUrl>>pathString (in category 'paths') -----
pathString
"Path as it appears in a URL with $/ as delimiter."
+ ^String streamContents: [ :s |
-
- ^String streamContents: [ :s | | first |
"isAbsolute ifTrue:[ s nextPut: $/ ]."
+ self path
+ do: [ :p | s nextPutAll: p encodeForHTTP ]
+ separatedBy: [ s nextPut: $/]]!
- first := true.
- self path do: [ :p |
- first ifFalse: [ s nextPut: $/ ].
- first := false.
- s nextPutAll: p encodeForHTTP ] ]!
Item was changed:
----- Method: Socket>>getOption: (in category 'other') -----
getOption: aName
"Get options on this socket, see Unix man pages for values for
+ sockets, IP, TCP, UDP. IE SO_KEEPALIVE
- sockets, IP, TCP, UDP. IE SO:=KEEPALIVE
returns an array, element one is an status number (0 ok, -1 read only option)
element two is the resulting of the requested option"
(socketHandle == nil or: [self isValid not])
ifTrue: [InvalidSocketStatusException signal: 'Socket status must valid before getting an option'].
^self primSocket: socketHandle getOption: aName
"| foo options |
Socket initializeNetwork.
foo := Socket newTCP.
foo connectTo: (NetNameResolver addressFromString: '192.168.1.1') port: 80.
foo waitForConnectionUntil: (Socket standardDeadline).
options := {
+ 'SO_DEBUG'. 'SO_REUSEADDR'. 'SO_REUSEPORT'. 'SO_DONTROUTE'.
+ 'SO_BROADCAST'. 'SO_SNDBUF'. 'SO_RCVBUF'. 'SO_KEEPALIVE'.
+ 'SO_OOBINLINE'. 'SO_PRIORITY'. 'SO_LINGER'. 'SO_RCVLOWAT'.
+ 'SO_SNDLOWAT'. 'IP_TTL'. 'IP_HDRINCL'. 'IP_RCVOPTS'.
+ 'IP_RCVDSTADDR'. 'IP_MULTICAST_IF'. 'IP_MULTICAST_TTL'.
+ 'IP_MULTICAST_LOOP'. 'UDP_CHECKSUM'. 'TCP_MAXSEG'.
+ 'TCP_NODELAY'. 'TCP_ABORT_THRESHOLD'. 'TCP_CONN_NOTIFY_THRESHOLD'.
+ 'TCP_CONN_ABORT_THRESHOLD'. 'TCP_NOTIFY_THRESHOLD'.
+ 'TCP_URGENT_PTR_TYPE'}.
- 'SO:=DEBUG'. 'SO:=REUSEADDR'. 'SO:=REUSEPORT'. 'SO:=DONTROUTE'.
- 'SO:=BROADCAST'. 'SO:=SNDBUF'. 'SO:=RCVBUF'. 'SO:=KEEPALIVE'.
- 'SO:=OOBINLINE'. 'SO:=PRIORITY'. 'SO:=LINGER'. 'SO:=RCVLOWAT'.
- 'SO:=SNDLOWAT'. 'IP:=TTL'. 'IP:=HDRINCL'. 'IP:=RCVOPTS'.
- 'IP:=RCVDSTADDR'. 'IP:=MULTICAST:=IF'. 'IP:=MULTICAST:=TTL'.
- 'IP:=MULTICAST:=LOOP'. 'UDP:=CHECKSUM'. 'TCP:=MAXSEG'.
- 'TCP:=NODELAY'. 'TCP:=ABORT:=THRESHOLD'. 'TCP:=CONN:=NOTIFY:=THRESHOLD'.
- 'TCP:=CONN:=ABORT:=THRESHOLD'. 'TCP:=NOTIFY:=THRESHOLD'.
- 'TCP:=URGENT:=PTR:=TYPE'}.
1 to: options size do: [:i | | fum |
fum :=foo getOption: (options at: i).
Transcript show: (options at: i),fum printString;cr].
foo := Socket newUDP.
foo setPeer: (NetNameResolver addressFromString: '192.168.1.9') port: 7.
foo waitForConnectionUntil: (Socket standardDeadline).
1 to: options size do: [:i | | fum |
fum :=foo getOption: (options at: i).
Transcript show: (options at: i),fum printString;cr].
"!
Item was changed:
----- Method: Socket>>setOption:value: (in category 'other') -----
setOption: aName value: aValue
| value |
"setup options on this socket, see Unix man pages for values for
+ sockets, IP, TCP, UDP. IE SO_KEEPALIVE
- sockets, IP, TCP, UDP. IE SO:=KEEPALIVE
returns an array, element one is the error number
element two is the resulting of the negotiated value.
See getOption for list of keys"
(socketHandle == nil or: [self isValid not])
ifTrue: [InvalidSocketStatusException signal: 'Socket status must valid before setting an option'].
value := aValue asString.
aValue == true ifTrue: [value := '1'].
aValue == false ifTrue: [value := '0'].
^ self primSocket: socketHandle setOption: aName value: value!
More information about the Squeak-dev
mailing list
|