Re: Sockets on Windows and Mac



rodmc <rodmc@xxxxxxxxxxx> wrote:

> I am new to Python and have been writing some socket based programmes
> on Windows (with some success), however I am unable to get them to work
> on Mac.
>
> Are there differences in the way the socket module works on Windows and
> Mac? I would appreciate any simple code samples people my have for
> creating a very basic server on Macpython, I have copied code from
> various tutorials but as yet they don't appear to work.

Assuming you mean the MacOS X which has been current, in one version or
another, for the last few years (I don't know anything about ancient
OS's such as MacOS 9 etc), I've personally tested all the socket
programming examples from the Nutshell on MacOS X 10.3 and 10.4 (Panther
and Tiger), and they do, of course, run just fine. You can download the
zipfile with all the examples of "Python in a Nutshell" from the
O'Reilly site, even if you don't own the book, and try them. Of course,
you must run a server and one or more client from different Terminal
windows -- that's about the only important (but totally obvious)
precaution you should take.

I don't think you can set the Mac's firewall to impede communication
within the localhost, but I admit I haven't tried -- so, if you have any
problem, detach your Mac from any networks and then in System
Preferences disable the firewall entirely (and make sure your Mac
doesn't erroneously believe it DOES have external networks, i.e., only
"networking" is to/from '127.0.0.1', the local host, AKA the loopback or
'lo0' interface). If you STILL have problems after that, copy and paste
the output of ifconfig, it should start something like:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000

and also any current messages from an instance of
Applications/Utilities/Console -- as well of course as error messages
and tracebacks, if any, from your Python scripts, but I think any
problem must result from some weird issue with system settings rather
than any programming issue. Do remember to copy and paste, NOT
summarize in your own words, otherwise you may make it unfeasible for us
to help you out!


Alex
.



Relevant Pages

  • Re: Mac e programmazione
    ... Xcode, che istalli dal mpkg o /Installers, per creare le GUI; ... per programmarle poi in Python. ... Su Mac, Python e` parte dell'OS, come lo e` Aqua per le GUI; ... Per creare un binario eseguibile su Windows (ad esempio con py2exe, ...
    (it.comp.macintosh)
  • Tkinter - non-ASCII characters in text widgets problem
    ... I'm writing an application in Python 2.5.4 under Windows. ... I use Tkinter as the main GUI toolkit. ... portable (not fully but win & mac os x is a must). ...
    (comp.lang.python)
  • RE: Is Python Mac Centric???
    ... They're for the benefit of the "Mac Classic" OSes, ... > they'll ever become apart of the official Python distribution. ... Both act against folding the Windows ... but why would Microsoft want to increase Python's user base? ...
    (comp.lang.python)
  • ANN: EasyDialogs for Windows version 46691.0
    ... EasyDialogs for Windows is a ctypes based emulation of the EasyDialogs ... module included in the Python distribution for Mac. ... tested on Python 2.3 running on Windows NT, 98, XP, and 2003. ...
    (comp.lang.python)
  • Re: How to get the local mac address?
    ... >> Windows but there is just another thread talking about one should write ... >> Is this a problem of the network library of python? ... is the reason for wanting to get at the MAC? ... out of the file handle of a socket but these modules don't exist on ...
    (comp.lang.python)