First of all, thanks for your help.
But this is just the problem. I have written many server / client models, so
perhaps I can explain the problem better like this:

1. Server listens on 127.0.0.1 on port 4444.
2. I send a test email.
3. Postfix connects and I "accept" a client socket side.
4. The client socket goes to another thread, who is waiting for work.
5. The server jumps back to "accept" and blocks there until there is a new
connection.
6. Let's say the second thread is working for 20 seconds before it can
answer on the client socket with action=...
7. While the worker thread is still working and the main thread is blocking
on accept(), I'm sending another e-mail.
8. The main thread is still blocking on accept(), there is no new client
connection.
9. Ok then I'll let the other thread send a reply after 20 seconds.
10. Now all of a sudden there is a new client connection.

This tells me that unfortunately, Postfix wants to have a reply first to
each request, before sending a new request.
Where do I go wrong then?


-----Original Message-----
From: owner-postfix-us...@postfix.org
[mailto:owner-postfix-us...@postfix.org] On Behalf Of Wietse Venema
Sent: vrijdag 26 februari 2016 19:31
To: Postfix users
Subject: Re: Postfix & check_policyd_service no concurrent connections?

Saskia van Schagen:
> Victor, thanks for trying to help out. But still this cannot be true. 
> In Postfix I cannot setup a different socket for each smtpd process, 
> if I had
> 100 smtpd processes, I cannot tell Postfix that each of these 100 
> processes should connect with a different client socket.

You have fundamentally not understood how TCP or UNIX-domain sockets work. 

> So we have one socket here, with 1 client side and 1 server side and 
> we're going to keep the connection alive.

No, there are N client endpoints for 1 server endpoint. The client invokes
connect(); the server invokes listen() once and invokes
accept() for every client connection. Then the server can receive data over
TCP streams.

Example:

server does listen() on 127.0.0.1 port 25

client does connect() to 127.0.0.1 port 25 from 127.0.0.1 port 5001

server does accept() which returns a socket for the above connection

client does connect() to 127.0.0.1 port 25 from 127.0.0.1 port 5002

server does accept() which returns a socket for the above connection

Now the server has two sockets for the accepted connections, and one socket
for accepting new connections.

Looks like you are accepting only one connection at a time.

        Wietse

Reply via email to