[PythonCE] Re: Re: Re: Twisted on PPC 2003 (Brad Clements)

Stewart Midwinter stewart.midwinter at gmail.com
Wed Jan 26 04:39:40 CET 2005

On Tue, 25 Jan 2005 16:01:18 -0700, James Burkert
<james.burkert at gmail.com> wrote:
> PS. Thanks for the tip on Tkinter (how do you pronounce that anyway?) :)

it's T - K - Inter.

Given your description of what you want to do, why not take a look at
the code below (from the Python.org site at:
http://docs.python.org/lib/socket-example.html ). Put the server code
on your desktop, the client code on your PDA, get a network connection
going with BT (and check it by running PIE and visiting an external
website), then run the client code on the PDA.

Here's the 2 pieces you'll need:

# Echo server program
import socket

HOST = ''                 # Symbolic name meaning the local host
PORT = 50007              # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if not data: break

# Echo client program
import socket

HOST = 'daring.cwi.nl'    # The remote host
PORT = 50007              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send('Hello, world')
data = s.recv(1024)
print 'Received', repr(data)


Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com

More information about the PythonCE mailing list