Re: Sockets on Windows and Mac

2006-01-10 Thread Peter Hansen
rodmc wrote:
> I am currently importing the socket library when I write the programs,
> I have had no problems with it on my PC at work, but the Mac at home
> steadfastly refuses to work. 

One rule about asking for help in forums like this is to provide 
adequate background detail about your environment.  Generally that 
includes version numbers of things.  What versions of Python are you 
trying to work with?

Note that the code you posted, from that tutorial, is out of date and 
needs to be fixed for recent versions of Python, where the argument to 
.bind() is a single tuple, not two separate arguments.

Anyway, next time please post snippets of your actual code, with the 
error tracebacks *cut and pasted* right out of your terminal window, so 
that you don't waste our time by making us guess what you're actually 
doing.  That way you'll get quick and accurate assistance and keep 
everyone helping you happy. :-)

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-09 Thread Grant Edwards
On 2006-01-08, rodmc <[EMAIL PROTECTED]> wrote:

> I am currently importing the socket library when I write the programs,
> I have had no problems with it on my PC at work, but the Mac at home
> steadfastly refuses to work.

Well, with details like that, we'll have your problem figured
out in no time!

-- 
Grant Edwards   grante Yow!  I HAVE a towel.
  at   
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
Hi Peter,

I am currently importing the socket library when I write the programs,
I have had no problems with it on my PC at work, but the Mac at home
steadfastly refuses to work. As for existing libraries, I am new to
Python so am kean to avoid re-inventing the wheel :-)

Cheers,

rod

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
I am on 10.3, I keep getting exceptions when it hits lines like

mySocket.bind (SERVER_IP, 2727 )
or
mySocket = socket.socket(socket.AF_NET,socket.SOCK_STREAM)

The code I am using is copied from a tutorial on a website somewhere.

Cheers,

rod

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
Hi Peter,

I am currently importing the socket library when I write the programs,
I have had no problems with it on my PC at work, but the Mac at home
steadfastly refuses to work. As for existing libraries, I am new to
Python so am kean to avoid re-inventing the wheel :-)

Cheers,

rod

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-08 Thread Alex Martelli
rodmc <[EMAIL PROTECTED]> 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 mtu 16384
inet 127.0.0.1 netmask 0xff00 

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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-08 Thread Peter Hansen
rodmc 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.

Aren't you basing this on the standard library modules such as 
SocketServer, or extension packages like Twisted, that already do most 
of the work for you?  If you were, you likely wouldn't have to deal with 
any such Mac-specific problems (if that's really what they are) and you 
would likely save yourself a whole heck of a lot of time reinventing the 
wheel too.  (Note also that most people doing raw socket programming do 
it wrong, which is a good reason to jump straight ahead to build on the 
work of others.)

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sockets on Windows and Mac

2006-01-08 Thread Irmen de Jong
rodmc 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.

Please elaborate on "unable to get them to work". What problems do you see?

In my experience, there is no difference with the Mac. I'm using a
mac (with OS X tiger) myself.


--Irmen
-- 
http://mail.python.org/mailman/listinfo/python-list


Sockets on Windows and Mac

2006-01-08 Thread rodmc
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.

Thanks,

rod

-- 
http://mail.python.org/mailman/listinfo/python-list