Hello,
Today I started trying to play around with networking in Smalltalk. I thought I knew what I was doing, but apparently not. I have a basic understanding of the concepts involved with networking and working with sockets, but have no experience programming with sockets. Here is my session... st> PackageLoader fileInPackage: 'Sockets'. "Global garbage collection... done" "Scavenging... 91% reclaimed, done" Loading package Sockets "Scavenging... 69% reclaimed, done" "Scavenging... 47% reclaimed, done" "Scavenging... 36% reclaimed, done" returned value is PackageLoader 5991 byte codes executed which took 0.064 seconds (0.056s user+0.008s sys) 479 primitives, percent 8.00 self returns 70, inst var returns 89, literal returns 14 124 method cache lookups since last cleanup, percent 2.07 53 method cache hits, 71 misses, 42.74 percent hits st> s := Sockets.Socket remote: 'localhost' port: 60890. stdin:3: Aborted (ip 44)SocketAddress class>>#extractAddressesAfterLookup: (ip 6)[] in SocketAddress class>>#allByName: (ip 4)<unwind> BlockClosure>>#ensure: (ip 48)[] in SocketAddress class>>#allByName: (ip 4)[] in SocketAddress class>>#at:cache: (ip 10)Dictionary>>#at:ifAbsent: (ip 18)SocketAddress class>>#at:cache: (ip 24)SocketAddress class>>#allByName: (ip 16)SocketAddress class>>#byName: (ip 10)Socket class(StreamSocket class)>>#remote:port:local:port: (ip 18)Socket class(StreamSocket class)>>#remote:port: (ip 10)UndefinedObject>>#executeStatements (ip 0)<bottom> Process gst aborted What am I doing wrong? Thanks, Aidan _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Thu, Dec 23, 2010 at 00:49, Aidan Gauland <[hidden email]> wrote:
> Hello, > > Today I started trying to play around with networking in Smalltalk. I > thought I knew what I was doing, but apparently not. I have a basic > understanding of the concepts involved with networking and working > with sockets, but have no experience programming with sockets. What platform are you on? What version of GNU Smalltalk? Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Thu, Dec 23, 2010 at 09:24:13AM +0100, Paolo Bonzini wrote:
> What platform are you on? What version of GNU Smalltalk? Debian squeeze GNU/Linux (Linux kernel 2.6.32-3-amd64). GNU Smalltalk version 3.1. --Aidan _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (205 bytes) Download Attachment |
On 12/23/2010 10:19 AM, Aidan Gauland wrote:
> On Thu, Dec 23, 2010 at 09:24:13AM +0100, Paolo Bonzini wrote: >> What platform are you on? What version of GNU Smalltalk? > > Debian squeeze GNU/Linux (Linux kernel 2.6.32-3-amd64). > GNU Smalltalk version 3.1. 3.2 is available from sid, I suggest you use that (or you can just build 3.2.3). Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Paolo Bonzini <bonzini <at> gnu.org> writes:
> On 12/23/2010 10:19 AM, Aidan Gauland wrote: > > On Thu, Dec 23, 2010 at 09:24:13AM +0100, Paolo Bonzini wrote: > >> What platform are you on? What version of GNU Smalltalk? > > > > Debian squeeze GNU/Linux (Linux kernel 2.6.32-3-amd64). > > GNU Smalltalk version 3.1. > > 3.2 is available from sid, I suggest you use that (or you can just build > 3.2.3). gnu-smalltalk-el from sid did not load properly, so I chose to build GST 3.2.3. My socket code no longer crashes gst. Thank you very much! --Aidan _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Aidan Gauland <aidalgol <at> no8wireless.co.nz> writes:
> gnu-smalltalk-el from sid did not load properly, so I chose to build > GST 3.2.3. My socket code no longer crashes gst. Thank you very > much! Claimed victory too soon. It doesn't crash, but I have no idea what I'm doing. I think I once figured out how to create send a string over a TCP connection in Squeak, but I hadn't a clue what I was doing. I was just hacking Smalltalk in highschool when I was bored. I've done a little with sockets in C, but only going through tutorials. Could someone please give me an example of using Sockets in Smalltalk for client-side stuff (or better yet, put it on the wiki)? There are a few decent *server* examples on the wiki, but no Smalltalk client as counterparts for them. --Aidan P.S. I ultimately want to write an IRC bot in Smalltalk, because I don't much fancy the available IRC bots and the languages for which IRC libraries are available. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Fri, Dec 24, 2010 at 10:24, Aidan Gauland <[hidden email]> wrote:
> Aidan Gauland <aidalgol <at> no8wireless.co.nz> writes: >> gnu-smalltalk-el from sid did not load properly, so I chose to build >> GST 3.2.3. My socket code no longer crashes gst. Thank you very >> much! > > Claimed victory too soon. It doesn't crash, but I have no idea what > I'm doing. I think I once figured out how to create send a string > over a TCP connection in Squeak, but I hadn't a clue what I was doing. > I was just hacking Smalltalk in highschool when I was bored. I've > done a little with sockets in C, but only going through tutorials. > > Could someone please give me an example of using Sockets in Smalltalk > for client-side stuff (or better yet, put it on the wiki)? There are > a few decent *server* examples on the wiki, but no Smalltalk client as > counterparts for them. Sockets are just streams, you use them with normal #nextPutAll:/#nextLine/#next:/#flush methods. For simple examples of clients you can look at the SMTP classes in packages/net/SMTP.st. I'll prepare some examples in the next few days. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Paolo Bonzini <bonzini <at> gnu.org> writes:
> Sockets are just streams, you use them with normal > #nextPutAll:/#nextLine/#next:/#flush methods. I knew that much. It's getting the Socket setup and connected that I'm having trouble with. > For simple examples of clients you can look at the SMTP classes in > packages/net/SMTP.st. I'll prepare some examples in the next few > days. Thanks, I'd really appreciate that! In the meantime, I'll follow your suggestion to look at SMTP.st. --Aidan _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Aidan Gauland-2
Hi Aidan,
If you have a mailserver running locally, here is some simple sockets code to access the response from it. $ cat gst31_sockettest.st #!/usr/bin/gst -f PackageLoader fileInPackage: 'NetClients'. s := Sockets.Socket remote: '127.0.0.1' port: 25. (s upTo: Character cr) printNl. s close. $ gst gst31_sockettest.st "Global garbage collection... done" Loading package Sockets Loading package SUnit Loading package NetClients '220 mailserver.ourdomain.com ESMTP Postfix' Regards Stephen On 24/12/10 10:24 PM, Aidan Gauland wrote: > Aidan Gauland<aidalgol<at> no8wireless.co.nz> writes: >> gnu-smalltalk-el from sid did not load properly, so I chose to build >> GST 3.2.3. My socket code no longer crashes gst. Thank you very >> much! > > Claimed victory too soon. It doesn't crash, but I have no idea what > I'm doing. I think I once figured out how to create send a string > over a TCP connection in Squeak, but I hadn't a clue what I was doing. > I was just hacking Smalltalk in highschool when I was bored. I've > done a little with sockets in C, but only going through tutorials. > > Could someone please give me an example of using Sockets in Smalltalk > for client-side stuff (or better yet, put it on the wiki)? There are > a few decent *server* examples on the wiki, but no Smalltalk client as > counterparts for them. > > --Aidan > > P.S. I ultimately want to write an IRC bot in Smalltalk, because I > don't much fancy the available IRC bots and the languages for which > IRC libraries are available. > > > > _______________________________________________ > help-smalltalk mailing list > [hidden email] > http://lists.gnu.org/mailman/listinfo/help-smalltalk > > _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |