Returning a tuple-struct

2006-01-18 Thread groups . 20 . thebriguy
I've noticed that there's a few functions that return what appears to be a tuple, but that also has attributes for each item in the tuple. For example, time.localtime() returns a time.time_struct, which looks like a tuple but also like a struct. That is, I can do: >>> time.localtime() (2006, 1, 1

Re: Subclassing socket

2006-01-13 Thread groups . 20 . thebriguy
I don't think this is true in all cases - for example, if the protocol is UDP, and the packet size is less than the MTU size. Although, I could be wrong - I've always thought that to be the case. I knew someone would have your response, that's why I earlier said I didn't want to argue that. :-)

Re: Subclassing socket

2006-01-13 Thread groups . 20 . thebriguy
Correction to my last post: It should say: "To your question of why you'd ever recv(0):" -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing socket

2006-01-13 Thread groups . 20 . thebriguy
Steve, To your question of why you'd ever receive value: This is very common in any network programming. If you send a packet of data that has a header and payload, and the header contains the length (N) of the payload, then at some point you have to receive N bytes. If N is zero, then you rece

Re: Subclassing socket

2005-12-21 Thread groups . 20 . thebriguy
More simple way? What's that? -- http://mail.python.org/mailman/listinfo/python-list

Subclassing socket

2005-12-20 Thread groups . 20 . thebriguy
socket objects have a little quirk. If you try to receive 0 bytes on a blocking socket, they block. That is, if I call recv(0), it blocks (until some data arrives). I think that's wrong, but I don't want to argue that. I would like to create a subclass of socket that fixes the problem. Ideally