[zeromq-dev] Load balancing & PGM
Steven McCoy
steven.mccoy at miru.hk
Mon Mar 30 09:57:54 CEST 2009
2009/3/30 Martin Sustrik <sustrik at fastmq.com>:
> This is on the roadmap already (ZMQ-204), still, won't listening socket
> signal POLLIN only if a new packet arrives? If so, the accept should be
> immediate.
I'm referring to the code pgm_socket.cpp:724-741:
s = socket (AF_INET, SOCK_RDM, IPPROTO_RM);
...
rc = bind (s, (SOCKADDR *)&salocal, sizeof(salocal));
...
rc = listen (s, 10);
...
receiver_socket = accept (s, (SOCKADDR *)&sasession, &sasessionsz);
This will block until the first packet arrives, ideally the socket s
should be used as part of your poll set before accepting the
connection and then adding receiver_socket.
On the connection notification you should be able to determine the
sender as per the accept manpage without the overhead of accepting
every connection:
"One can obtain user connection request data without confirming the con-
nection by issuing a recvmsg(2) call with an msg_iovlen of 0 and a non-
zero msg_controllen, or by issuing a getsockopt(2) request."
--
Steve-o
More information about the zeromq-dev
mailing list