Dennis Lee Bieber <wlfr...@ix.netcom.com> 於 2019年11月21日 週四 上午2:17寫道:

> On Wed, 20 Nov 2019 18:51:31 +0800, lampahome <pahome.c...@mirlab.org>
> declaimed the following:
>
> >
> >I only use a while loop to catch events like below:
> >import select, socket
> >sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> >sock.bind()
>
>         Documentation indicates that one must provide an address (ip,
> port) for
> the bind -- there is no default described.
>
> sorry, I just write a brief code so I don't write whole detail ex: (ip,
port). But it can receive any connection and bind successfully.


> >sock.listen(10)
>
>         You've specified that 10 connections can be held in the backlog,
> any
> beyond that will be refused.
>
> But there's one client and it send 128 messages with different length.


> for fd,event in events:
> >  if event & select.EPOLLIN:
> >    sock.recv(1024)
> >...
>
>         Documentation is a bit week -- there is no description of what
> .poll()
> returns in the help file.
>
>         Point #1: you are using STREAM => implies TCP. TCP is not a
> "message"
> related protocol. Multiple "sends" can be one "receive" packet. One "send"
> can also be multiple "receive" packets. You truncated anything that would
> show if your processing is parsing out some high-level protocol showing the
> handling of such combined or split packets.
>
> Maybe this is the point! Multiple sends which doesn't full a 1024-length
buffer will make me receive one packet.


>         Also, the help system links to
> https://linux.die.net/man/4/epoll
> which has
> """
> Q7
>     If more than one event comes in between epoll_wait(2) calls, are they
> combined or reported separately?
> A7
>     They will be combined.
> """
>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to