Nmap Development mailing list archives

Re: ncat's nsock vs. nmap nsock


From: doug () hcsw org
Date: Thu, 8 May 2008 14:36:18 -0700

On Thu, May 08, 2008 at 12:23:15PM -0700 or thereabouts, Fyodor wrote:
    /* Traditional read() - no SSL - using recv() because that works
       better on Windows */

So we did use read() there some years ago, but it didn't work properly
on Windows.

IIRC, unlike unix, win32 distinguishes between POSIX file descriptors
(int) and sockets (SOCKET). This goes all the way back to win3.1 winsock
and the consequence is that you can't use recv() to read from files (you
will get a WSAENOTSOCK error) and you can't use read() to read from
sockets (you will get an EBADF error). Also, you can't fdopen() sockets
for the same reason (sockets aren't file descriptors in win32).

http://msdn.microsoft.com/en-us/library/ms740121(VS.85).aspx
http://msdn.microsoft.com/en-us/library/wyssk1bs(VS.80).aspx

This is for the win32 API--I have no idea with .NET.

Doug

Attachment: signature.asc
Description: Digital signature


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: