December 27th, 2003, 03:57 PM
Random assorted questions :)
Hello... I'm hoping some people can provide some insight to the following:
1) Can I pass variables of primitive types (like ints, bools, longs, etc) by reference in Python, as in C++? If not, what's the best way to emulate this behavior -- to make a "wrapper" class for the primitive type, and to pass an object of this class holding the primitive type variable by reference?
2) I'm working a peer-to-peer program written in Python. Thus I need to make extensive use of Python's socket interface. I was wondering if any of you have ever written programs in Python that establish a large number of connections simultaneously (as in, between 16 and 32), and if so, when all these connections are idle, or barely using the bandwidth of your DSL/cable line, have you noticed any slowdown? I bring this up because my roommate complained that my using BitTorrent was slowing down his Internet connection significantly -- even though I was only downloading at 5K/sec, and we share a DSL line! A friend of mine related a similar experience with his roommate using BitTorrent. I'm hoping to attribute this to the way BitTorrent functions/how it is coded, and not Python itself.
December 27th, 2003, 05:32 PM
Well, as for (2): Remember that most DSL connections are half-duplex, which means that the total bandwidth is shared by downloading connections and uploading connections; even more, most DSL connections are asymmetric, which means that the download bandwidth and the upload bandwidth are different in magnitude. But even if your upload bandwidth is less than your download bandwidth, the total bandwidth is shared as if they were equal. If you use half your upload bandwidth, half your download bandwidth will be gone.
December 27th, 2003, 07:19 PM
Hrmmm, point noted percivall. Although I remember uploading at only 5K/sec as well, so that might not have been the issue.
Thanks for the info, however. As for point #1, ignore it -- I figured something out