"C4368 error - mixed types are not supported"
You are trying to create a C++ CLI class with std C++ members, which is not possible, although you can access standard C++ classes form within member functions of a CLI class. If you turn off support for Common Language Runtime, you get lots of errors as you are trying to compile a CLI class.
It appears you are trying to write a .NET library with C++, but you talk about wanting the library to be portable. As has been mentioned, you may be able to do this with the Mono Framework, however, I am presuming that you don't want to be dependent upon .NET in your C++ library but want it to be a native library for the platform you install it on.
If you want a native common library, with networking functionailty in it, you will need to provide some sort of abstraction of the network layers, as they are different as CPallini has mentioned. There are plenty of good cross platform networking libraries about.
Qt[
^] has some and the
ACE framework[
^] also has a lot of good features.