Sockets broken on Macs?

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

Sockets broken on Macs?

Rob Withers
I recently had a problem using sockets on the Mac and I was looking for help.  I was using the normal socket class and I was using the listen/accept protocols to establish a listening socket.  I then attempted to use another Socket to connectTo but it failed.  This works on windows.  I even tried the accept protocol where you can specify the interface, but that also failed.
 
Do I need to do something special on Macs to get sockets to accept and connect?   Are Sockets broken on Macs?
 
thanks,
Robert


Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Andreas.Raab
Check your firewall settings and send the code you used. There might be
something glaringly obvious if we'd know what you're doing.

Cheers,
   - Andreas

Rob Withers wrote:

> I recently had a problem using sockets on the Mac and I was looking for
> help.  I was using the normal socket class and I was using the
> listen/accept protocols to establish a listening socket.  I then
> attempted to use another Socket to connectTo but it failed.  This works
> on windows.  I even tried the accept protocol where you can specify the
> interface, but that also failed.
>  
> Do I need to do something special on Macs to get sockets to accept and
> connect?   Are Sockets broken on Macs?
>  
> thanks,
> Robert
>
>
> ------------------------------------------------------------------------
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Rob Withers
Well how bout that.   You had me go in to build an example that  
wasn't using ConnectionHandler, since it isn't standard code.  So I  
ran some of the tests on the Socket class and they work.  My problem  
is that I was listening to a port lower than 1024, 443 specifically  
since we are trying to write SSL code.  I switched to a high port and  
it worked.   Fantastic.   I don't particularly know why it couldn't  
run at a lower port as I am an administrator.

cheers,
Robert


On Sep 20, 2006, at 11:23 AM, Andreas Raab wrote:

> Check your firewall settings and send the code you used. There  
> might be something glaringly obvious if we'd know what you're doing.
>
> Cheers,
>   - Andreas
>
> Rob Withers wrote:
>> I recently had a problem using sockets on the Mac and I was  
>> looking for help.  I was using the normal socket class and I was  
>> using the listen/accept protocols to establish a listening  
>> socket.  I then attempted to use another Socket to connectTo but  
>> it failed.  This works on windows.  I even tried the accept  
>> protocol where you can specify the interface, but that also failed.
>>  Do I need to do something special on Macs to get sockets to  
>> accept and connect?   Are Sockets broken on Macs?
>>  thanks,
>> Robert
>> ---------------------------------------------------------------------
>> ---
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

brad fowlow

You'd have to sudo the Squeak process in order bind low-numbered ports.

(Being an administrator means you can sudo,
but normal processes aren't run as super-user unless you ask.)


On Sep 20, 2006, at 5:10 PM, Robert Withers wrote:

   I don't particularly know why it couldn't run at a lower port as I am an administrator.




Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

johnmci
On a mac, being the administrator doesn't mean you are root  
automatically, a small security measure. Unlike *cough* other  
operating systems where root/admin is a theoretical concept, with  
fuzzy implementation completely side-stepped by all users on the  
machine...

Lastly if you dig about in the os-x unix roots you'll find sudo so  
you can set a squeak process to run as super user to get access to  
ports < 1024 and the user does not have to be admin. However this is  
not a good solution you might consider some more research to see how  
to avoid running squeak as root.

On 20-Sep-06, at 6:10 PM, brad fowlow wrote:

>
> You'd have to sudo the Squeak process in order bind low-numbered  
> ports.
>
> (Being an administrator means you can sudo,
> but normal processes aren't run as super-user unless you ask.)
>
>
> On Sep 20, 2006, at 5:10 PM, Robert Withers wrote:
>
>>    I don't particularly know why it couldn't run at a lower port  
>> as I am an administrator.
>
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Rob Withers
I forgot all about sudo, so thanks for the reminders.   Is it  
possible to run  a program with sudo and still launch it from an  
icon?   I suppose I really should buy a book on how to use the Mac...

On Sep 20, 2006, at 6:31 PM, John M McIntosh wrote:

> On a mac, being the administrator doesn't mean you are root  
> automatically, a small security measure. Unlike *cough* other  
> operating systems where root/admin is a theoretical concept, with  
> fuzzy implementation completely side-stepped by all users on the  
> machine...
>
> Lastly if you dig about in the os-x unix roots you'll find sudo so  
> you can set a squeak process to run as super user to get access to  
> ports < 1024 and the user does not have to be admin. However this  
> is not a good solution you might consider some more research to see  
> how to avoid running squeak as root.
>
> On 20-Sep-06, at 6:10 PM, brad fowlow wrote:
>
>>
>> You'd have to sudo the Squeak process in order bind low-numbered  
>> ports.
>>
>> (Being an administrator means you can sudo,
>> but normal processes aren't run as super-user unless you ask.)
>>
>>
>> On Sep 20, 2006, at 5:10 PM, Robert Withers wrote:
>>
>>>    I don't particularly know why it couldn't run at a lower port  
>>> as I am an administrator.
>>
>>
>
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

johnmci
Nay, you need a book on how to run unix.

On 20-Sep-06, at 7:20 PM, Robert Withers wrote:

> I forgot all about sudo, so thanks for the reminders.   Is it  
> possible to run  a program with sudo and still launch it from an  
> icon?   I suppose I really should buy a book on how to use the Mac...

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Rob Withers
I do ok with unix, but the issue is tying an icon to 'sudo squeak'  
and that's a Mac UI thing.  It's prolly fairly simple.  Another Mac  
issue I have is how to clear out old application bindings to files  
with particular extensions.  My squeak images are still bound to a  
prior non-existing version of the squeak vm.

On Sep 20, 2006, at 8:47 PM, John M McIntosh wrote:

> Nay, you need a book on how to run unix.
>
> On 20-Sep-06, at 7:20 PM, Robert Withers wrote:
>
>> I forgot all about sudo, so thanks for the reminders.   Is it  
>> possible to run  a program with sudo and still launch it from an  
>> icon?   I suppose I really should buy a book on how to use the Mac...
>
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

johnmci
If you have a shell script "foobar" and rename it to "foobar.command"  
then double-clicking on it will launch Terminal and it will run the  
shell script.
Or you install the OSProcess plugin (unix osx) and use the carbon or  
unix VM to invoke the shell script via a handy squeak application.

For the bindings issues select the image, do get info and down at the  
Open with:  tab select which app to  use, and if you want all  
documents of this type to open with that application, etc.   That  
should fix the launch database.

On 20-Sep-06, at 9:38 PM, Robert Withers wrote:

> I do ok with unix, but the issue is tying an icon to 'sudo squeak'  
> and that's a Mac UI thing.  It's prolly fairly simple.  Another Mac  
> issue I have is how to clear out old application bindings to files  
> with particular extensions.  My squeak images are still bound to a  
> prior non-existing version of the squeak vm.
>
> On Sep 20, 2006, at 8:47 PM, John M McIntosh wrote:
>
>> Nay, you need a book on how to run unix.
>>
>> On 20-Sep-06, at 7:20 PM, Robert Withers wrote:
>>
>>> I forgot all about sudo, so thanks for the reminders.   Is it  
>>> possible to run  a program with sudo and still launch it from an  
>>> icon?   I suppose I really should buy a book on how to use the  
>>> Mac...
>>
>> --
>> =====================================================================
>> ======
>> John M. McIntosh <[hidden email]>
>> Corporate Smalltalk Consulting Ltd.  http://
>> www.smalltalkconsulting.com
>> =====================================================================
>> ======
>>
>>
>>
>
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Georg Gollmann
In reply to this post by johnmci
Am 21.09.2006 um 03:31 schrieb John M McIntosh:

> On a mac, being the administrator doesn't mean you are root  
> automatically, a small security measure. Unlike *cough* other  
> operating systems where root/admin is a theoretical concept, with  
> fuzzy implementation completely side-stepped by all users on the  
> machine...
>
> Lastly if you dig about in the os-x unix roots you'll find sudo so  
> you can set a squeak process to run as super user to get access to  
> ports < 1024 and the user does not have to be admin. However this  
> is not a good solution you might consider some more research to see  
> how to avoid running squeak as root.

One technique I use (with GemStone on Linux) is to use the firewall  
to map the privileged port number to an unprivileged one.
On Linux with iptables the spell for the "nat" table is for example
> -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8008

On the Mac do a "man ipfw" or use a graphical front end for the  
firewall configuration.

Good luck!

Kind regards
Georg



Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

Giovanni Giorgi-3
In reply to this post by Rob Withers
Search for DropScript
Can "transform" a command line...command  in a "inconized app".
Happy mac-cing ;)

On 9/21/06, Robert Withers <[hidden email]> wrote:

> I do ok with unix, but the issue is tying an icon to 'sudo squeak'
> and that's a Mac UI thing.  It's prolly fairly simple.  Another Mac
> issue I have is how to clear out old application bindings to files
> with particular extensions.  My squeak images are still bound to a
> prior non-existing version of the squeak vm.
>
> On Sep 20, 2006, at 8:47 PM, John M McIntosh wrote:
>
> > Nay, you need a book on how to run unix.
> >
> > On 20-Sep-06, at 7:20 PM, Robert Withers wrote:
> >
> >> I forgot all about sudo, so thanks for the reminders.   Is it
> >> possible to run  a program with sudo and still launch it from an
> >> icon?   I suppose I really should buy a book on how to use the Mac...
> >
> > --
> > ======================================================================
> > =====
> > John M. McIntosh <[hidden email]>
> > Corporate Smalltalk Consulting Ltd.  http://
> > www.smalltalkconsulting.com
> > ======================================================================
> > =====
> >
> >
> >
>
>
>


--
Software Architect
http://www.objectsroot.com/
Software is nothing

Reply | Threaded
Open this post in threaded view
|

Re: Sockets broken on Macs?

David T. Lewis
In reply to this post by Georg Gollmann
On Thu, Sep 21, 2006 at 09:31:45AM +0200, Georg Gollmann wrote:

> Am 21.09.2006 um 03:31 schrieb John M McIntosh:
> >Lastly if you dig about in the os-x unix roots you'll find sudo so  
> >you can set a squeak process to run as super user to get access to  
> >ports < 1024 and the user does not have to be admin. However this  
> >is not a good solution you might consider some more research to see  
> >how to avoid running squeak as root.
>
> One technique I use (with GemStone on Linux) is to use the firewall  
> to map the privileged port number to an unprivileged one.
> On Linux with iptables the spell for the "nat" table is for example
> >-A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8008

That's a good suggestion.

Running the Squeak VM as root means that absolutely everthing that
happens in Squeak is done will full root privileges. Don't do that.

In principle, you could also have a plugin with a primitive to
change the effective user ID for the running VM, such that you
could temporarily ask for root privilege long enough to get access
to the socket (see the unix man page for setuid). But this requires
installing the Squeak VM with special permissions, and it hardly
seems worth the trouble if you can remap the ports in some way.

Dave