Okay, now I am getting really confused... Sorry, it's partly because of my lack of experience... but I'll go ahead and say how I again bumped into a dead end.
I found no winsock2.h under my National Instruments\CVI85\sdk\include (winsock.h exists though under this folder) I also found no ws2-32.lib anywhere in under my National Instrument folder. But I found both of them under my MATLAB directory...
So I copy-pasted winsock2.h into National Instruments\CVI85\sdk\include and #include <winsock2.h> in my c application. I also copy-pasted ws2_32.lib into National Instruments\CVI85\extlib, and added it to my project.
When I compile my code this way, it gives me lots of "redefinition of macro " errors, for example for 'WSAEINTR', 'WSAEBADF' and so on...
If I change #include <winsock2.h> to #include <winsock.h>, the compile works fine, but linker gives error "Read error"...
I have no idea what this means and how it can get solved. Thanks again for your time.