time or the lack of it...
Dan Ingalls
Dan at SqueakLand.org
Wed Nov 21 17:06:10 UTC 2001
John M McIntosh <johnmci at smalltalkconsulting.com> wrote...
>Yes a bit much, but very interesting. I'm tempted to punt so to speak and go ask my friendly time server what the time is.
>
> | serverAddr s |
> Socket initializeNetworkIfFail: [^self error: 'Failed to init network'].
> serverAddr _ NetNameResolver addressForName: 'time-a.nist.gov' timeout: 10.
> serverAddr = nil ifTrue: [self error: 'Could not find the address for time-a.nist.gov'].
> s _ Socket new.
> s connectTo: serverAddr port: 13. s waitForConnectionUntil: (self deadlineSecs: 15).
> Transcript show: 'the time server reports: ' , s getResponseNoLF,' at time ',Time now printString;cr.
> s closeAndDestroy.
>
>Try it,
This is cool. But when you try, use
"Socket deadlineSecs: 15"
instead of
"self deadlineSecs: 15"
- Dan
More information about the Squeak-dev
mailing list
|