Help needed

Hyuga hyugaricdeau at gmail.com
Fri Jan 11 09:49:09 EST 2008


On Jan 10, 9:15 pm, tijo <tijotom... at gmail.com> wrote:
> Hi mate
>
> i need o do a python program to connect 2 systems using TCP/IP and
> UDP. Also i need to check the performance of these two protocols (how
> many bytes received and how much time took). I havent worked in python
> earlier and have no idea of this. Could someone pls help me. I created
> a program which can connect between 2 systems using these UDP and TCP/
> IP protocols. I dont know how to check the rest like how many bytes
> send or how much time taken
> since this is part of my course work could someone please help me
> thanks in advance.
>
> tijo

The standard library documentation, while lacking in some areas, is
very much your friend here:

>From http://docs.python.org/lib/socket-objects.html (emphasis mine)
send(string[, flags])
Send data to the socket. The socket must be connected to a remote
socket. The optional flags argument has the same meaning as for recv()
above. *Returns the number of bytes sent.*

recv(bufsize[, flags])
Receive data from the socket. The return value is a string
representing the data received.

For timing you can probably use the timeit module (http://
docs.python.org/lib/module-timeit.html) but I'm not really sure how
you're defining "performance".  I mean, I can already tell you that
overall UDP will be "faster", as it has much less overhead.  Surely
your course has covered this...

Hyuga



More information about the Python-list mailing list