on windows, is there any other option when programming network communication then using Winsock? There are many soc开发者_开发技巧ket libraries for c++, are they all just winsock based?
You can consider using boost::asio
. Boost is really great and well designed. Many parts of it have come already into C++0x. You will need to statically link to a lib or dll (it is not a header only template library)
Winsock are the sockets for Windows taken over from BSD (with actually exactly the same API excepting for closesocket
vs close
and the initialization/termination of the subsystem). Not the Win API itself has a more modern API the WSAxxx
functions. C++ is socket unaware until now that means in order to do networking you MUST use the OS API, thus Winsock. There is no other low level API.
If you are trying to monitor traffic why don't you use WinPCAP?
There are other ways to program network communication, which don't use Winsock: for example, using the network file system (shared files), or using named pipes.
Software can also bypass Winsock (which is a Windows user-mode DLL) even for TCP/IP traffic, and instead interface directly with the kernel-mode drivers.
精彩评论