The argument is a file, not a socket. socket's are created with the socket(2) syscall.
13 pages link to ENOTSOCK: