udp sockets with python
calderone.jeanpaul at gmail.com
Tue Nov 9 17:20:40 CET 2010
On Nov 9, 5:20 am, Mag Gam <magaw... at gmail.com> wrote:
> When measuring round trip time for the UDP echo client/server the C
> version is much faster. I was wondering if there is anything I can do
> to speed up.
> My current code for client looks like this....
> for x in range (1000):
> The server code looks like this:
> while 1:
> I am measuring the round trip time using tcpdump. The C version is
> giving me around 80 microseconds (average) and the python is giving me
> close to 300 microseconds (average).
Try replacing the hostname in your send calls with an IP address. If
you're not passing an IP address here, then the Python version has to
do a name lookup for each send, I bet your C version is not.
More information about the Python-list