Re: TCP (or UDP) daytime client in Smalltalk

"[email protected]" <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>
It works !  Thanks for your help:

Assuming that the old 'legacy' daytime stream server runs on tcp port 13:

$ gst daytime.st 
Loading package ObjectDumper
Loading package Sockets
'Sat Jun  6 10:30:16 2020'

$ cat daytime.st 

Eval [

PackageLoader fileInPackage: 'Sockets'.

s _ Sockets.Socket remote:(Sockets.SocketAddress createLoopbackHost) port:13.
(s upTo: Character cr) printNl.
s close.

]



So the problem was that you have to use the 'namespace'.

Thanks,
David Stes


----- Op 4 jun 2020 om 20:15 schreef Derek Zhou [email protected]:

> [email protected] writes:
> 
>> The docs have an incorrect reference:
>>
>> https://www.gnu.org/software/smalltalk/manual/html_node/Network-support.html#Network-support
>>
>> if you click on " Network programming with Sockets " that link is broken.
> Use the locally install docs. And most likely you need to read the
> source code as the doc is not that good.
>>
>> I've tried the following:
>>
>> Eval [
>>
>> PackageLoader fileInPackage: 'Sockets'.
>> PackageLoader fileInPackage: 'NetClients'.
>>
>> s _ Socket remote:(SocketAddress createLoopbackHost) port:13.
>> (s upTo: Character cr) printNl.
>> s close.
>>
>> ]
>>
>> This fails:
>>
>> Object: nil error: did not understand #createLoopbackHost
>> MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
>> UndefinedObject(Object)>>doesNotUnderstand: #createLoopbackHost
>> (SysExcept.st:1408)
>> UndefinedObject>>executeStatements (daytime.st:7)
>>
>>
>> Apparently it does not know about the SocketAdress class (subclass of
>> IPAddress).  There must be some other way apparently to load that class.
>>
>> Shouldn't loading the packages be sufficient to get the SocketAdress class ?
> 
> Yes. However, gnu smalltalk has namespace. It should be Sockets.SocketAddress,
> or you
> can <import: Sockets>
> 
> Derek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.