nginx for Windows - WSASend() socket error 10057

Yury Shpakov yshpakov at
Wed Feb 12 17:59:30 UTC 2020

Hi Sergey,

Thank you for you response.

I tried netstat /nabo and I don't see any reference to port 9000 at all.
So a problem is to make nginx to listen on port 9000 (as server)?
Or nginx is not listening on port 9000 but rather sending requests to port 9000 (as client)?

Maybe it's easier not to use auth_http at all? I was trying to remove it from configuration file but nginx was not happy.
At this point I don't need any authentication. I was told by my boss to use nginx for load testing of our service sending emails (SMTP client). I've got some SMTP Server and nginx would be used as SMTP proxy because it allows to set up delays.

And take into account that I REMOVED "--with-http_ssl_module" from parameters when I was building nginx.

And you advised to download some nginx.exe files but I believe they were built without "--with-mail" parameter (which I need).

Thank you,
From: Sergey Brester <serg.brester at>
Sent: Wednesday, February 12, 2020 7:38 AM
To: nginx-devel at <nginx-devel at>
Cc: Yury Shpakov <yshpakov at>
Subject: Re: nginx for Windows - WSASend() socket error 10057

It looks like your service defined in auth_http doesn't answer (or no listener on port 9000?)...

try netstat (in cmd as admin):

netstat /nabo
netstat /nabo | grep -A 1 ":9000\b"

and check whether the listener on port 9000 is bound to (or it is only?) and it is the process you expect to see there (can be "reserved" by some other windows-service).

additionally try to telnet or curl it:

curl -H "Auth-Method: plain" -H "Auth-User: user" -H "Auth-Pass: pwd" -H "Auth-Protocol: imap" -H "Auth-Login-Attempt: 1" -i

if it does not answer, make another attempt by replace with (or a host-name).

If it answers - see whether it is the expected response (some examples of good and bad responses are described in

But I guess if WSASend fails, it would probably (unexpected) reject the connection during the send (or even connect) process.
It can be also invalid (unexpected) content-length in keep-alive connect to auth-upstream - so send but still receive is expected (or vice versa).

Also follow this forum topic addressing similar issue:,257206,257207#msg-257207

Anyway it doesn't look to me like an issue of nginx (regardless windows or not), but you can also try some other ready build (for example on my GH<> -<>, where it works well).


12.02.2020 03:01, Yury Shpakov wrote:

Hi there,

Trying to make nginx work as SMTP server and/or SMTP proxy. Done everything according to:

But excluded (don't care about SSL at this point so don't want to install/configure Perl now):
    --with-openssl=objs/lib/openssl-master \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module \
And added:
nmake was successful and nginx.exe was created.

However nginx.exe keeps failing with the error:
WSASend() failed (10057: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied) while in http auth state, client:, server:

Windows API says the following about this error:


Socket is not connected.
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto<>) no address was supplied. Any other type of operation might also return this error—for example, setsockopt<> setting SO_KEEPALIVE<> if the connection has been reset.
Windows Sockets Error Codes (Winsock2.h) - Win32 apps | Microsoft Docs<>
Return code/value Description; WSA_INVALID_HANDLE 6: Specified event object handle is invalid. An application attempts to use an event object, but the specified handle is not valid.

Managed to debug your code in VS 2010 a little bit but it's brutal C so it's hard to figure your code out. And this debugger doesn't show you any local variables values.

Any recommendation for me to make it work?

Tried to play with config (commenting/uncommenting):

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/;

events {
    worker_connections  1024;

mail {
    server_name       localhost;
    auth_http         localhost:9000/cgi-bin/nginxauth.cgi;
#    auth_http         none;

    smtp_auth         none;
#    smtp_auth         login plain cram-md5;
#    smtp_capabilities "SIZE 10485760" ENHANCEDSTATUSCODES 8BITMIME DSN;
    xclient           off;

    server {
        listen   8025;
        protocol smtp;
        proxy    on;
        proxy_pass_error_message on;

Tried both under a regular user and under admin. Tried on 25, 1025 and 8025 ports.

Thank you,

nginx-devel mailing list
nginx-devel at<mailto:nginx-devel at>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list