[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: UDP Client/Server

Guilherme Polo

1/22/2008 11:56:00 PM

2008/1/22, Martin Marcher <martin@marcher.name>:
> Hello,
>
> I created a really simple udp server and protocol but I only get every 2nd
> request (and thus answer just every second request).
>
> Maybe someone could shed some light, I'm lost in the dark(tm), sorry if this
> is a bit oververbose but to me everything that happens here is black magic,
> and I have no clue where the packages go. I can't think of a simpler
> protocol than to just receive a fixed max UDP packet size and answer
> immediately (read an "echo" server).
>
> thanks
> martin
>
>
> ### server
> >>> from socket import *
> >>> import SocketServer
> >>> from SocketServer import BaseRequestHandler, UDPServer
> >>> class FooReceiveServer(SocketServer.UDPServer):
> ... def __init__(self):
> ... SocketServer.UDPServer.__init__(self, ("localhost", 4321),
> FooRequestHandler)
> ...
> >>> class FooRequestHandler(BaseRequestHandler):
> ... def handle(self):
> ... data, addr_info = self.request[1].recvfrom(65534)

Your FooReceiveServer subclasses UDPServer, it already handled the
recvfrom for you, so, this is wrong.

> ... print data
> ... print addr_info
> ... self.request[1].sendto("response", addr_info)
> ...
> >>> f = FooReceiveServer()
> >>> f.serve_forever()
> request 0
> ('127.0.0.1', 32884)
> request 1
> ('127.0.0.1', 32884)
> request 2
> ('127.0.0.1', 32884)
> request 2
> ('127.0.0.1', 32884)
> request 2
> ('127.0.0.1', 32884)
>
>
>
> ### client
> >>> target = ('127.0.0.1', 4321)
> >>> from socket import *
> >>> s = socket(AF_INET, SOCK_DGRAM)
> >>> for i in range(10):
> ... s.sendto("request " + str(i), target)
> ... s.recv(65534)
> ...
> 9
> Traceback (most recent call last):
> File "<stdin>", line 3, in <module>
> KeyboardInterrupt
> >>> s.sendto("request " + str(i), target)
> 9
> >>> str(i)
> '0'
> >>> for i in range(10):
> ... s.sendto("request " + str(i), target)
> ... s.recv(65534)
> ...
> 9
> 'response'
> 9
> 'response'
> 9
> Traceback (most recent call last):
> File "<stdin>", line 3, in <module>
> KeyboardInterrupt
> >>> #this was hanging, why?
> ...
> >>> s.sendto("request " + str(i), target)
> 9
> >>> s.recv(65534)
> 'response'
> >>> s.sendto("request " + str(i), target)
> 9
> >>> s.recv(65534)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> KeyboardInterrupt
> >>> s.sendto("request " + str(i), target)
> 9
> >>> s.sendto("request " + str(i), target)
> 9
> >>> s.recv(65534)
> 'response'
> >>> s.recv(65534)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> KeyboardInterrupt
> >>> s.sendto("request " + str(i), target)
> 9
> >>>
>
> --
> http://noneisyours.ma...
> http://feeds.feedburner.com/N...
>
> You are not free to read this message,
> by doing so, you have violated my licence
> and are required to urinate publicly. Thank you.
>
> --
> http://mail.python.org/mailman/listinfo/p...
>


--
-- Guilherme H. Polo Goncalves
27 Answers

The Peeler

2/18/2014 10:54:00 PM

0

On Tue, 18 Feb 2014 14:30:10 -0800 (PST), Moose in Love with Nazi Scum, now
trolling as T Rex PhD, wrote:

>> Feeling lonely again moose droppings that's why you flooding the NG with
>>
>> crap ?
>>
>> or
>>
>> Is this some side effect of the drugs that you are now smoking / snorting /
>>
>> injecting ?
>>
>> David
>
> I can always beat dorks

...."off", you mean! We KNOW, Nazi-cock sucker!

--
Moose in Love with Nazi Scum about his eyeing of his schoolmates' dicks:
"I was one of the few guys in gym class to have skin intact.
Even in the '80's when I went to the gym, most guys were cut."
MID: <0fb300f4-e4ea-4d5a-b66c-28a449e25962@u7g2000yqg.googlegroups.com>

The Revd

2/18/2014 11:29:00 PM

0

On Tue, 18 Feb 2014 14:30:10 -0800 (PST), T Rex PhD
<parkstreetbooboo@gmail.com> wrote:

>On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>> T Rex PhD <parkstreetbooboo@gmail.com> wrote in news:69d08fbc-afe4-4a01-
>>
>> a31f-430f4c8f3981@googlegroups.com:
>>
>>
>>
>> > A classic scene from a class director:
>>
>> > http://www.youtube.com/watch?v=i...
>>
>>
>>
>> Feeling lonely again moose droppings that's why you flooding the NG with
>>
>> crap ?
>>
>>
>>
>> or
>>
>>
>>
>> Is this some side effect of the drugs that you are now smoking / snorting /
>>
>> injecting ?
>>
>>
>>
>> David
>
>How is a scene like that crap? Maybe you'd like to explain? I can always beat dorks like you down with proper logic, so think it through and be careful.

This is some new, uppity little jewboi, recently appeared on the
scene. He doesn't know what he's up against! LOLK

A Moose in Love

2/18/2014 11:31:00 PM

0

On Tuesday, February 18, 2014 6:29:05 PM UTC-5, The Revd wrote:
> On Tue, 18 Feb 2014 14:30:10 -0800 (PST), T Rex PhD
>
> <parkstreetbooboo@gmail.com> wrote:
>
>
>
> >On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>
> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in news:69d08fbc-afe4-4a01-
>
> >>
>
> >> a31f-430f4c8f3981@googlegroups.com:
>
> >>
>
> >>
>
> >>
>
> >> > A classic scene from a class director:
>
> >>
>
> >> > http://www.youtube.com/watch?v=i...
>
> >>
>
> >>
>
> >>
>
> >> Feeling lonely again moose droppings that's why you flooding the NG with
>
> >>
>
> >> crap ?
>
> >>
>
> >>
>
> >>
>
> >> or
>
> >>
>
> >>
>
> >>
>
> >> Is this some side effect of the drugs that you are now smoking / snorting /
>
> >>
>
> >> injecting ?
>
> >>
>
> >>
>
> >>
>
> >> David
>
> >
>
> >How is a scene like that crap? Maybe you'd like to explain? I can always beat dorks like you down with proper logic, so think it through and be careful.
>
>
>
> This is some new, uppity little jewboi, recently appeared on the
>
> scene. He doesn't know what he's up against! LOLK

He's a jackasski!

The Revd

2/18/2014 11:46:00 PM

0

On Tue, 18 Feb 2014 15:30:30 -0800 (PST), T Rex PhD
<parkstreetbooboo@gmail.com> wrote:

>On Tuesday, February 18, 2014 6:29:05 PM UTC-5, The Revd wrote:
>> On Tue, 18 Feb 2014 14:30:10 -0800 (PST), T Rex PhD
>>
>> <parkstreetbooboo@gmail.com> wrote:
>>
>>
>>
>> >On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>>
>> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in news:69d08fbc-afe4-4a01-
>>
>> >>
>>
>> >> a31f-430f4c8f3981@googlegroups.com:
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> > A classic scene from a class director:
>>
>> >>
>>
>> >> > http://www.youtube.com/watch?v=i...
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> Feeling lonely again moose droppings that's why you flooding the NG with
>>
>> >>
>>
>> >> crap ?
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> or
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> Is this some side effect of the drugs that you are now smoking / snorting /
>>
>> >>
>>
>> >> injecting ?
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> David
>>
>> >
>>
>> >How is a scene like that crap? Maybe you'd like to explain? I can always beat dorks like you down with proper logic, so think it through and be careful.
>>
>>
>>
>> This is some new, uppity little jewboi, recently appeared on the
>>
>> scene. He doesn't know what he's up against! LOLK
>
>He's a jackasski!

His IP address shows he's from your part of the world - Kitchener or
nearby!

A Moose in Love

2/19/2014 12:12:00 AM

0

On Tuesday, February 18, 2014 6:46:04 PM UTC-5, The Revd wrote:
> On Tue, 18 Feb 2014 15:30:30 -0800 (PST), T Rex PhD
>
> <parkstreetbooboo@gmail.com> wrote:
>
>
>
> >On Tuesday, February 18, 2014 6:29:05 PM UTC-5, The Revd wrote:
>
> >> On Tue, 18 Feb 2014 14:30:10 -0800 (PST), T Rex PhD
>
> >>
>
> >> <parkstreetbooboo@gmail.com> wrote:
>
> >>
>
> >>
>
> >>
>
> >> >On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>
> >>
>
> >> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in news:69d08fbc-afe4-4a01-
>
> >>
>
> >> >>
>
> >>
>
> >> >> a31f-430f4c8f3981@googlegroups.com:
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> > A classic scene from a class director:
>
> >>
>
> >> >>
>
> >>
>
> >> >> > http://www.youtube.com/watch?v=i...
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> Feeling lonely again moose droppings that's why you flooding the NG with
>
> >>
>
> >> >>
>
> >>
>
> >> >> crap ?
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> or
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> Is this some side effect of the drugs that you are now smoking / snorting /
>
> >>
>
> >> >>
>
> >>
>
> >> >> injecting ?
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> David
>
> >>
>
> >> >
>
> >>
>
> >> >How is a scene like that crap? Maybe you'd like to explain? I can always beat dorks like you down with proper logic, so think it through and be careful.
>
> >>
>
> >>
>
> >>
>
> >> This is some new, uppity little jewboi, recently appeared on the
>
> >>
>
> >> scene. He doesn't know what he's up against! LOLK
>
> >
>
> >He's a jackasski!
>
>
>
> His IP address shows he's from your part of the world - Kitchener or
>
> nearby!

Hell no! I'll check this dorkBreath out. Maybe he's from the nearby inferiour city of Cambridge.

The Revd

2/19/2014 1:06:00 AM

0

On Tue, 18 Feb 2014 16:11:36 -0800 (PST), T Rex PhD
<parkstreetbooboo@gmail.com> wrote:

>On Tuesday, February 18, 2014 6:46:04 PM UTC-5, The Revd wrote:
>> On Tue, 18 Feb 2014 15:30:30 -0800 (PST), T Rex PhD
>>
>> <parkstreetbooboo@gmail.com> wrote:
>>
>>
>>
>> >On Tuesday, February 18, 2014 6:29:05 PM UTC-5, The Revd wrote:
>>
>> >> On Tue, 18 Feb 2014 14:30:10 -0800 (PST), T Rex PhD
>>
>> >>
>>
>> >> <parkstreetbooboo@gmail.com> wrote:
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> >On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>>
>> >>
>>
>> >> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in news:69d08fbc-afe4-4a01-
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> a31f-430f4c8f3981@googlegroups.com:
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> > A classic scene from a class director:
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> > http://www.youtube.com/watch?v=i...
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> Feeling lonely again moose droppings that's why you flooding the NG with
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> crap ?
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> or
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> Is this some side effect of the drugs that you are now smoking / snorting /
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> injecting ?
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >>
>>
>> >>
>>
>> >> >> David
>>
>> >>
>>
>> >> >
>>
>> >>
>>
>> >> >How is a scene like that crap? Maybe you'd like to explain? I can always beat dorks like you down with proper logic, so think it through and be careful.
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> This is some new, uppity little jewboi, recently appeared on the
>>
>> >>
>>
>> >> scene. He doesn't know what he's up against! LOLK
>>
>> >
>>
>> >He's a jackasski!
>>
>>
>>
>> His IP address shows he's from your part of the world - Kitchener or
>>
>> nearby!
>
>Hell no! I'll check this dorkBreath out. Maybe he's from the nearby inferiour city of Cambridge.

He won't last long. Another one of these ten post wonders.

The Peeler

2/19/2014 12:20:00 PM

0

On Tue, 18 Feb 2014 16:11:36 -0800 (PST), Moose in Love with Nazi Scum, now
trolling as T Rex PhD, wrote:

>>
>>>He's a jackasski!
>>
>> His IP address shows he's from your part of the world - Kitchener or
>>
>> nearby!
>
> Hell no! I'll check this dorkBreath out. Maybe he's from the nearby inferiour city of Cambridge.

Hard to decide which is the dumber of the two of you! BTW, anyone need some
hankies? LOL

--
Moose in Love with Nazi Scum having his coming out on these groups as
"Slutty Ho' from Manilla":
"Hello sailor. If you've got the money, I've got the honey."
MID: <6ea0a18c-2acb-424a-9fdf-0704b19e742e@u7g2000yqg.googlegroups.com>

David

2/19/2014 5:37:00 PM

0

T Rex PhD <parkstreetbooboo@gmail.com> wrote in
news:105a97bb-cfb8-4f85-9c18-50a5e554a98c@googlegroups.com:

> On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>> T Rex PhD <parkstreetbooboo@gmail.com> wrote in
>> news:69d08fbc-afe4-4a01-
>>
>> a31f-430f4c8f3981@googlegroups.com:
>>
>>
>>
>> > A classic scene from a class director:
>>
>> > http://www.youtube.com/watch?v=i...
>>
>>
>>
>> Feeling lonely again moose droppings that's why you flooding the NG
>> with
>>
>> crap ?
>>
>>
>>
>> or
>>
>>
>>
>> Is this some side effect of the drugs that you are now smoking /
>> snorting /
>>
>> injecting ?
>>
>>
>>
>> David
>
> How is a scene like that crap? Maybe you'd like to explain? I can
> always beat dorks like you down with proper logic, so think it through
> and be careful.

Moose droppings your claimed logic over the years has given us much
amusement and confirmed that you have no idea of what you are talking
about.

Most of what you perceive as logic are the ramblings of your drug adicted
mind !

David

A Moose in Love

2/19/2014 6:03:00 PM

0

On Wednesday, February 19, 2014 12:37:07 PM UTC-5, David wrote:
> T Rex PhD <parkstreetbooboo@gmail.com> wrote in
>
> news:105a97bb-cfb8-4f85-9c18-50a5e554a98c@googlegroups.com:
>
>
>
> > On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>
> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in
>
> >> news:69d08fbc-afe4-4a01-
>
> >>
>
> >> a31f-430f4c8f3981@googlegroups.com:
>
> >>
>
> >>
>
> >>
>
> >> > A classic scene from a class director:
>
> >>
>
> >> > http://www.youtube.com/watch?v=i...
>
> >>
>
> >>
>
> >>
>
> >> Feeling lonely again moose droppings that's why you flooding the NG
>
> >> with
>
> >>
>
> >> crap ?
>
> >>
>
> >>
>
> >>
>
> >> or
>
> >>
>
> >>
>
> >>
>
> >> Is this some side effect of the drugs that you are now smoking /
>
> >> snorting /
>
> >>
>
> >> injecting ?
>
> >>
>
> >>
>
> >>
>
> >> David
>
> >
>
> > How is a scene like that crap? Maybe you'd like to explain? I can
>
> > always beat dorks like you down with proper logic, so think it through
>
> > and be careful.
>
>
>
> Moose droppings your claimed logic over the years has given us much
>
> amusement and confirmed that you have no idea of what you are talking
>
> about.
>
>
>
> Most of what you perceive as logic are the ramblings of your drug adicted
>
> mind !
>
>
>
> David

Fine. Let's argue something then. Was Dresden Firebombed? Were many if not most of the people down there innocent?
Was Hanover not the recipient of White Phosphorous. Did WP quench when it's recipients dunked themselves under water, only to start burning again when the victim surfaced? Were innocent babies not burned/maimed/killed?

David

2/19/2014 6:40:00 PM

0

T Rex PhD <parkstreetbooboo@gmail.com> wrote in
news:10d41d10-77a3-47b5-b155-7232a639d1fc@googlegroups.com:

> On Wednesday, February 19, 2014 12:37:07 PM UTC-5, David wrote:
>> T Rex PhD <parkstreetbooboo@gmail.com> wrote in
>>
>> news:105a97bb-cfb8-4f85-9c18-50a5e554a98c@googlegroups.com:
>>
>>
>>
>> > On Tuesday, February 18, 2014 5:20:00 PM UTC-5, David wrote:
>>
>> >> T Rex PhD <parkstreetbooboo@gmail.com> wrote in
>>
>> >> news:69d08fbc-afe4-4a01-
>>
>> >>
>>
>> >> a31f-430f4c8f3981@googlegroups.com:
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> > A classic scene from a class director:
>>
>> >>
>>
>> >> > http://www.youtube.com/watch?v=i...
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> Feeling lonely again moose droppings that's why you flooding the
>> >> NG
>>
>> >> with
>>
>> >>
>>
>> >> crap ?
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> or
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> Is this some side effect of the drugs that you are now smoking /
>>
>> >> snorting /
>>
>> >>
>>
>> >> injecting ?
>>
>> >>
>>
>> >>
>>
>> >>
>>
>> >> David
>>
>> >
>>
>> > How is a scene like that crap? Maybe you'd like to explain? I can
>>
>> > always beat dorks like you down with proper logic, so think it
>> > through
>>
>> > and be careful.
>>
>>
>>
>> Moose droppings your claimed logic over the years has given us much
>>
>> amusement and confirmed that you have no idea of what you are talking
>>
>> about.
>>
>>
>>
>> Most of what you perceive as logic are the ramblings of your drug
>> adicted
>>
>> mind !
>>
>>
>>
>> David
>
> Fine. Let's argue something then. Was Dresden Firebombed? Were many
> if not most of the people down there innocent? Was Hanover not the
> recipient of White Phosphorous. Did WP quench when it's recipients
> dunked themselves under water, only to start burning again when the
> victim surfaced? Were innocent babies not burned/maimed/killed?


Moose droppings, this is one of your eternal and perenial posts that has
been answered ad naseum - go read all those old posts over many years !!

Ah, I see we are back to your other perenial theme "burnt babies". Short
answer for you - blame the parents for placing their children in danger
by voting hitler and his nazi thugs into power.

Perhaps you would like to debate the countless children murdered by the
nazi death factories - and that was long before Dresden got fried.


But what you should really do is to examine why the german people of
nineteen thirties decided to abandon all their morals and follow a
monster who ultimately used them and left them and their country in
ruins.

David