Macintosh localhost (127.0.0.1) connection problem

Gordon McMillan gmcm at hypernet.com
Wed Aug 8 17:22:52 EDT 2001


[posted and mailed]

Timothy Jordan wrote: 

> Platform: Apple Macintosh G3
> OS: Mac OS 9.0
> 
> I can't seem to find a way to use python to connect the localhost
> address on a Mac.  I've been using httplib.HTTP() to connect to the
> host '127.0.0.1'.  When connecting, it crashes the system.  No error is
> displayed.  In addtion, I added a hosts file through the TCP/IP control
> panel containing "localhost A 127.0.0.1".  Internet Explorer can
> connect to 'http://localhost' properly but python returns 'error: host
> not found'.  Any suggestions?

I hesitate to even enter this thread.

It took me 2 months of intense frustration to get this working on the mac, 
and it still doesn't work very well. I had to make extensive patches to GUSI 
(which macPython uses to present a somewhat POSIX-ish layer on top of the 
raw - and I mean *raw* - OS 9 facilities). Not all my GUSI patches were 
accepted (understandably, because they still have problems).

First localhost: netscape will happily go looking for "www.localhost.com". 
IE seems to have it hardcoded. If *they* don't know how to make use of the 
info put into the control panel applet, no surprise no one else does, 
either.

No idea why connect crashes (except the obvious - you're on a mac), but all 
kinds of things don't work well when the server & client are on the same 
machine. The reason being that the mac is "cooperatively" multiprocessed. If 
the guy doing the "connect" doesn't release the CPU, the guy doing the 
"accept" can't process the connection request. This was the focus of my 
efforts: getting "accept" to do it's work in the interrupt, not whenever 
some other app decides to be polite and release the CPU.

If my client continues to fund this work (a big "if"), I'll try to produce 
acceptable patches. If someone with a high tolerance for frustration is 
interested in picking up where I left off, email me. Otherwise, if you 
insist on using a mac, upgrade to OS X.

- Gordon




More information about the Python-list mailing list