UDP socket, need help setting sending port

Sells, Fred fred at adventistcare.org
Tue Dec 20 05:33:58 CET 2005

I'm using MSW XP Pro with Python 2.4 to develop but production will be Linux
with Python 2.3.  (could upgrade to 2.4 if absolutely necessary) I can also
switch to Linux for development if necessary.

I am writing some python to replace proprietary software that talks to a
timeclock via UDP.

The timeclock extracts the sending port from the UDP header and uses that
for all response messages.

I cannot find out how to set the sending port in the header.  Windows XP
appears to set an arbitrary port.  I've been using ethereal to analyze
network traffic and it seems that if I can set the sending port, I should be

I have been googling various combinations of "python udp ..." for the last
two hours and have not found anything that addresses how to set the sending
port.  I'm guessing that this may be in setsockopt but don't see any
parameters that "click".

Any help would be greatly appreciated.

Fred Sells
fred at adventistcare dotttttt org

The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any

More information about the Python-list mailing list