On Tue, Mar 13, 2012 at 4:43 AM, Sven Van Caekenberghe <[email protected]>wrote:
> Can anyone please help me and show me where I should look if I wanted to > see the exact C code implementing the socket primitives (for the Pharo > built Cog VMs) ? > In trunk (and in my Cog vm source) they are in the directories http://squeakvm.org/svn/squeak/trunk/platforms/{Cross,MacOS,unix,win32}/plugins/SocketPlugin i.e. in all VMs locate the relevant platforms hierarchy and look in platforms/{Cross,Mac OS,unix,win32}/plugins/SocketPlugin. > On 09 Mar 2012, at 16:44, Sven Van Caekenberghe wrote: > > > Most socket API's allow for the creation of a server socket on the next > available port, often by specifying 0 instead of a port. When the socket is > bound, one can retrieve the local port and let the client(s) know. I tried > to do that in Pharo today, and these steps seem to work, by accepting an > incoming connection gives a primitive failed. > > > > Anyone tried this ? > > > > | socket | > > socket := Socket newTCP. > > socket listenOn: 0. > > [ [ > > Transcript crShow: 'Port is ', socket localPort printString. > > (socket waitForAcceptFor: 60) > > ifNotNil: [ :client | | data | > > data := client receiveDataTimeout: 30. > > Transcript crShow: 'Received ', data asString. > > data ifNotNil: [ client sendData: data reverse; > close ] > > ]. > > ] ensure: [ socket close ] ] fork. > > > > I am running the Pharo Cog VM on Mac OS X using Pharo 1.4. > > > > Thx, > > > > Sven > > > > -- best, Eliot
