How to read from and write to a Unix domain socket

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to read from and write to a Unix domain socket

Damien Cassou
 
Hi,

some days ago I asked on stackoverflow a question about Unix domain
socket for Pharo. Bert told me it is possible but I didn't find the
source code or examples. Could you please give me a few more hints?

You can answer by email or on
http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo

Thank you very much

Best

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

Bert Freudenberg

On 28.05.2012, at 12:00, Damien Cassou wrote:

> Hi,
>
> some days ago I asked on stackoverflow a question about Unix domain
> socket for Pharo. Bert told me it is possible but I didn't find the
> source code or examples. Could you please give me a few more hints?
>
> You can answer by email or on
> http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
>
> Thank you very much
>
> Best


The SocketPlugin supports all socket families nowadays. There are new primitives, in addition to the old ones. So far I think only Etoys uses them. I see for example a method SocketAddressInformation class>>addressFamilyLocal in addition to #addressFamilyINET4 and addressFamilyINET6, which must be good for something.

It can use more than IPv4 for sure:

NetNameResolver addressesForName: 'localhost'
        ==> an OrderedCollection(
                ::1(localhost),0(0)-inet6-stream-tcp
                127.0.0.1(localhost),0(0)-inet4-stream-tcp
                fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)

This was added a couple years ago by Ian Piumarta and Michael Rüger.

Levente ported the in-image code to Squeak last year, but it was never actually adopted:

        http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html

This should be a good starting point for you. You won't find an example for domain sockets because the main purpose of the new plugin was to support IPv6. But Ian made it generic enough so it should work with any socket family.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

Luc Fabresse
 
Hi Bert,

 We had hard time to understand everything with Noury while working on Ocean (Network).
 
 The new primitives seems to be there in the new VMs (Cog).
 With Jannik we loaded the Etoys image side code to access them. But, it seems that it does not completly work (on mac).
 Probably because the C plugin code is not in sync perhaps it has been modified in VMMaker branch and it has not been merged in Cog branch. 

 My question is: do you know if the socket plugin code (all plateforms: unix, ios, win) is the latest one in cog repository (same as in VMMaker)?

Thanks,

Luc  

2012/5/28 Bert Freudenberg <[hidden email]>

On 28.05.2012, at 12:00, Damien Cassou wrote:

> Hi,
>
> some days ago I asked on stackoverflow a question about Unix domain
> socket for Pharo. Bert told me it is possible but I didn't find the
> source code or examples. Could you please give me a few more hints?
>
> You can answer by email or on
> http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
>
> Thank you very much
>
> Best


The SocketPlugin supports all socket families nowadays. There are new primitives, in addition to the old ones. So far I think only Etoys uses them. I see for example a method SocketAddressInformation class>>addressFamilyLocal in addition to #addressFamilyINET4 and addressFamilyINET6, which must be good for something.

It can use more than IPv4 for sure:

NetNameResolver addressesForName: 'localhost'
       ==> an OrderedCollection(
               ::1(localhost),0(0)-inet6-stream-tcp
               127.0.0.1(localhost),0(0)-inet4-stream-tcp
               fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)

This was added a couple years ago by Ian Piumarta and Michael Rüger.

Levente ported the in-image code to Squeak last year, but it was never actually adopted:

       http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html

This should be a good starting point for you. You won't find an example for domain sockets because the main purpose of the new plugin was to support IPv6. But Ian made it generic enough so it should work with any socket family.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

David T. Lewis
 
The socket plugin updates seem to be missing in the Cog branch (checking
both VMMaker-oscog-EstebanLorenzano.158 and VMMaker.oscog-eem.160). It
should be OK to pull in the updates directly from VMMaker trunk, i.e. from
VMMaker-dtl.274, although it may be that platform support code will also
be needed for the Cog branch (I did not check this).

Dave

On Mon, May 28, 2012 at 04:58:20PM +0200, Luc Fabresse wrote:

>  
> Hi Bert,
>
>  We had hard time to understand everything with Noury while working on
> Ocean (Network).
>
>  The new primitives seems to be there in the new VMs (Cog).
>  With Jannik we loaded the Etoys image side code to access them. But, it
> seems that it does not completly work (on mac).
>  Probably because the C plugin code is not in sync perhaps it has been
> modified in VMMaker branch and it has not been merged in Cog branch.
>
>  My question is: do you know if the socket plugin code (all plateforms:
> unix, ios, win) is the latest one in cog repository (same as in VMMaker)?
>
> Thanks,
>
> Luc
>
> 2012/5/28 Bert Freudenberg <[hidden email]>
>
> >
> > On 28.05.2012, at 12:00, Damien Cassou wrote:
> >
> > > Hi,
> > >
> > > some days ago I asked on stackoverflow a question about Unix domain
> > > socket for Pharo. Bert told me it is possible but I didn't find the
> > > source code or examples. Could you please give me a few more hints?
> > >
> > > You can answer by email or on
> > >
> > http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
> > >
> > > Thank you very much
> > >
> > > Best
> >
> >
> > The SocketPlugin supports all socket families nowadays. There are new
> > primitives, in addition to the old ones. So far I think only Etoys uses
> > them. I see for example a method SocketAddressInformation
> > class>>addressFamilyLocal in addition to #addressFamilyINET4 and
> > addressFamilyINET6, which must be good for something.
> >
> > It can use more than IPv4 for sure:
> >
> > NetNameResolver addressesForName: 'localhost'
> >        ==> an OrderedCollection(
> >                ::1(localhost),0(0)-inet6-stream-tcp
> >                127.0.0.1(localhost),0(0)-inet4-stream-tcp
> >                fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)
> >
> > This was added a couple years ago by Ian Piumarta and Michael R?ger.
> >
> > Levente ported the in-image code to Squeak last year, but it was never
> > actually adopted:
> >
> >
> > http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html
> >
> > This should be a good starting point for you. You won't find an example
> > for domain sockets because the main purpose of the new plugin was to
> > support IPv6. But Ian made it generic enough so it should work with any
> > socket family.
> >
> > - Bert -
> >
> >
> >

Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

Sean P. DeNigris
Administrator
David T. Lewis wrote
The socket plugin updates seem to be missing in the Cog branch (checking
both VMMaker-oscog-EstebanLorenzano.158 and VMMaker.oscog-eem.160).
It seemed to me that recent sources from Jenkins only have primitives for ip4 and ip6.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

EstebanLM

Current socket plugin is not building ipv6 primitives... I don't know why, maybe a sync issue.

Esteban

On May 29, 2012, at 3:59 AM, Sean P. DeNigris wrote:

>
>
> David T. Lewis wrote
>>
>> The socket plugin updates seem to be missing in the Cog branch (checking
>> both VMMaker-oscog-EstebanLorenzano.158 and VMMaker.oscog-eem.160).
>
> It seemed to me that recent sources from Jenkins only have primitives for
> ip4 and ip6.
>
> --
> View this message in context: http://forum.world.st/How-to-read-from-and-write-to-a-Unix-domain-socket-tp4632170p4632247.html
> Sent from the Squeak VM mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

David T. Lewis
In reply to this post by Bert Freudenberg
 
On Mon, May 28, 2012 at 01:21:56PM +0200, Bert Freudenberg wrote:

>
> On 28.05.2012, at 12:00, Damien Cassou wrote:
>
> > Hi,
> >
> > some days ago I asked on stackoverflow a question about Unix domain
> > socket for Pharo. Bert told me it is possible but I didn't find the
> > source code or examples. Could you please give me a few more hints?
> >
> > You can answer by email or on
> > http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
> >
> > Thank you very much
> >
> > Best
>
>
> The SocketPlugin supports all socket families nowadays. There are new primitives, in addition to the old ones. So far I think only Etoys uses them. I see for example a method SocketAddressInformation class>>addressFamilyLocal in addition to #addressFamilyINET4 and addressFamilyINET6, which must be good for something.
>
> It can use more than IPv4 for sure:
>
> NetNameResolver addressesForName: 'localhost'
> ==> an OrderedCollection(
> ::1(localhost),0(0)-inet6-stream-tcp
> 127.0.0.1(localhost),0(0)-inet4-stream-tcp
> fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)
>
> This was added a couple years ago by Ian Piumarta and Michael R?ger.
>
> Levente ported the in-image code to Squeak last year, but it was never actually adopted:
>
> http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html

I updated Levente's image updates and will move them to trunk in a few days
if no problems arise. See squeak-dev for the updates and any follow ups.

Dave


>
> This should be a good starting point for you. You won't find an example for domain sockets because the main purpose of the new plugin was to support IPv6. But Ian made it generic enough so it should work with any socket family.
>
> - Bert -
>
Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

stephane ducasse-2

for your info mike spent time to port the IPV6 code from etoy to pharo and we removed it after because
it was not working.

Stef

On Jun 5, 2012, at 4:35 AM, David T. Lewis wrote:

>
> On Mon, May 28, 2012 at 01:21:56PM +0200, Bert Freudenberg wrote:
>>
>> On 28.05.2012, at 12:00, Damien Cassou wrote:
>>
>>> Hi,
>>>
>>> some days ago I asked on stackoverflow a question about Unix domain
>>> socket for Pharo. Bert told me it is possible but I didn't find the
>>> source code or examples. Could you please give me a few more hints?
>>>
>>> You can answer by email or on
>>> http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
>>>
>>> Thank you very much
>>>
>>> Best
>>
>>
>> The SocketPlugin supports all socket families nowadays. There are new primitives, in addition to the old ones. So far I think only Etoys uses them. I see for example a method SocketAddressInformation class>>addressFamilyLocal in addition to #addressFamilyINET4 and addressFamilyINET6, which must be good for something.
>>
>> It can use more than IPv4 for sure:
>>
>> NetNameResolver addressesForName: 'localhost'
>> ==> an OrderedCollection(
>> ::1(localhost),0(0)-inet6-stream-tcp
>> 127.0.0.1(localhost),0(0)-inet4-stream-tcp
>> fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)
>>
>> This was added a couple years ago by Ian Piumarta and Michael R?ger.
>>
>> Levente ported the in-image code to Squeak last year, but it was never actually adopted:
>>
>> http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html
>
> I updated Levente's image updates and will move them to trunk in a few days
> if no problems arise. See squeak-dev for the updates and any follow ups.
>
> Dave
>
>
>>
>> This should be a good starting point for you. You won't find an example for domain sockets because the main purpose of the new plugin was to support IPv6. But Ian made it generic enough so it should work with any socket family.
>>
>> - Bert -
>>

Reply | Threaded
Open this post in threaded view
|

Re: How to read from and write to a Unix domain socket

David T. Lewis
 
Thanks Stef,

The unit tests definitely did not pass. I've been working on further
updates to get it to work properly and also to pass all tests. It was
a bit tricky actually, but hopefully it will be ready to go within a
few more days.

Dave

On Tue, Jun 05, 2012 at 08:44:45PM +0200, stephane ducasse wrote:

>
> for your info mike spent time to port the IPV6 code from etoy to pharo and we removed it after because
> it was not working.
>
> Stef
>
> On Jun 5, 2012, at 4:35 AM, David T. Lewis wrote:
>
> >
> > On Mon, May 28, 2012 at 01:21:56PM +0200, Bert Freudenberg wrote:
> >>
> >> On 28.05.2012, at 12:00, Damien Cassou wrote:
> >>
> >>> Hi,
> >>>
> >>> some days ago I asked on stackoverflow a question about Unix domain
> >>> socket for Pharo. Bert told me it is possible but I didn't find the
> >>> source code or examples. Could you please give me a few more hints?
> >>>
> >>> You can answer by email or on
> >>> http://stackoverflow.com/questions/10759301/how-to-read-from-and-write-to-a-unix-domain-socket-in-pharo
> >>>
> >>> Thank you very much
> >>>
> >>> Best
> >>
> >>
> >> The SocketPlugin supports all socket families nowadays. There are new primitives, in addition to the old ones. So far I think only Etoys uses them. I see for example a method SocketAddressInformation class>>addressFamilyLocal in addition to #addressFamilyINET4 and addressFamilyINET6, which must be good for something.
> >>
> >> It can use more than IPv4 for sure:
> >>
> >> NetNameResolver addressesForName: 'localhost'
> >> ==> an OrderedCollection(
> >> ::1(localhost),0(0)-inet6-stream-tcp
> >> 127.0.0.1(localhost),0(0)-inet4-stream-tcp
> >> fe80::1%lo0(localhost),0(0)-inet6-stream-tcp)
> >>
> >> This was added a couple years ago by Ian Piumarta and Michael R?ger.
> >>
> >> Levente ported the in-image code to Squeak last year, but it was never actually adopted:
> >>
> >> http://forum.world.st/Re-The-Inbox-Network-ul-100-mcz-td3618715.html
> >
> > I updated Levente's image updates and will move them to trunk in a few days
> > if no problems arise. See squeak-dev for the updates and any follow ups.
> >
> > Dave
> >
> >
> >>
> >> This should be a good starting point for you. You won't find an example for domain sockets because the main purpose of the new plugin was to support IPv6. But Ian made it generic enough so it should work with any socket family.
> >>
> >> - Bert -
> >>