Skip to content

ncat: nsock_loop error 10038 #978

@nnposter

Description

@nnposter

Synopsis:
Ncat 7.60 on Windows is unable to perform a simple client TCP connect. The same problem is not observed on Linux. A nine-months old version of ncat also works fine.

The key error message is

libnsock select_loop(): nsock_loop error 10038: An operation was attempted on something that is not a socket.

There was no recent change in routine select_loop() in nsock/src/engine_select.c to provide an obvious explanation.

Details:
The following is observed on Windows 8 with stock ncat 7.60 (and also on Windows 7 with close-enough ncat r36949):

C:\temp>ncat -vv 10.128.24.212 21
Ncat: Version 7.60 ( https://nmap.org/ncat )
NCAT DEBUG: Using trusted CA certificates from C:\temp\ca-bundle.crt.
libnsock nsock_iod_new2(): nsock_iod_new (IOD #1)
libnsock nsock_connect_tcp(): TCP connection requested to 10.128.24.212:21 (IOD #1) EID 8
libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [10.128.24.212:21]
Ncat: Connected to 10.128.24.212:21.
libnsock nsock_iod_new2(): nsock_iod_new (IOD #2)
libnsock nsock_read(): Read request from IOD #1 [10.128.24.212:21] (timeout: -1ms) EID 18
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #2 [peer unspecified] EID 26
libnsock select_loop(): nsock_loop error 10038: An operation was attempted on something that is not a socket.
Ncat: 0 bytes sent, 0 bytes received in 0.06 seconds.

The same version of ncat (r36949) on Ubuntu does not have the problem:

$ ncat -vv 10.128.24.212 21
Ncat: Version 7.60SVN ( https://nmap.org/ncat )
NCAT DEBUG: Using system default trusted CA certificates and those in /usr/share/ncat/ca-bundle.crt.
libnsock nsock_iod_new2(): nsock_iod_new (IOD #1)
libnsock nsock_connect_tcp(): TCP connection requested to 10.128.24.212:21 (IOD #1) EID 8
libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [10.128.24.212:21]
Ncat: Connected to 10.128.24.212:21.
libnsock nsock_iod_new2(): nsock_iod_new (IOD #2)
libnsock nsock_read(): Read request from IOD #1 [10.128.24.212:21] (timeout: -1ms) EID 18
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #2 [peer unspecified] EID 26
libnsock nsock_trace_handler_callback(): Callback: READ SUCCESS for EID 18 [10.128.24.212:21] (20 bytes): 220 (vsFTPd 3.0.2)..
220 (vsFTPd 3.0.2)
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #1 [10.128.24.212:21] EID 34

An older version of ncat (r36483) on the same Windows 8 and Windows 7 also works fine:

C:\oldncat\ncat -vv 10.128.24.212 21
Ncat: Version 7.31SVN ( https://nmap.org/ncat )
NCAT DEBUG: Using trusted CA certificates from C:\oldncat\ca-bundle.crt.
NCAT DEBUG: Unable to load trusted CA certificates from C:\oldncat\ca-bundle.crt: error:02001002:system library:fopen:No such file or directory
libnsock nsock_iod_new2(): nsock_iod_new (IOD #1)
libnsock nsock_connect_tcp(): TCP connection requested to 10.128.24.212:21 (IOD #1) EID 8
libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [10.128.24.212:21]
Ncat: Connected to 10.128.24.212:21.
libnsock nsock_iod_new2(): nsock_iod_new (IOD #2)
libnsock nsock_read(): Read request from IOD #1 [10.128.24.212:21] (timeout: -1ms) EID 18
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #2 [peer unspecified] EID 26
libnsock nsock_trace_handler_callback(): Callback: READ SUCCESS for EID 18 [10.128.24.212:21] (20 bytes): 220 (vsFTPd 3.0.2)..
220 (vsFTPd 3.0.2)
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #1 [10.128.24.212:21] EID 34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions