Click here to Skip to main content
15,889,826 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What include files are required when writing TCP code in C++ and Visual Studio. Pressing F1 and looking at class TCPClient, for example, does not show what help files must be used. When I search for:

+"#include" +"c++" +"visual studio"

my pluses and quotes seem to be flatly ignored and the returns don't have what I need. (What phrase would you use for this search?)

I am not sure yet what I need to use but it is some combination of winsockets, TCPClient, and TCPListener and maybe some other goodies.

So, What include files do you use when writing code that uses TCP/IP?
Posted

Try Using managed TCP/IP Libraries[^] from here on CP.

The search I used was c++.net tcp/ip.
 
Share this answer
 
Since you are trying to use managed classes via C++/CLI, you don't need to #include any files. Instead you add a reference to the appropriate assemblies and then put using namespace declarations on top for convenience.

In this case the assembly you need is System.dll (you probably have a reference already). The namespace is System.Net.Sockets.
 
Share this answer
 
After downloading the code and building Visual studio provides a warning and an error. The error is:

VB
Error   2   Command line error D8016 : '/Gm' and '/clr:oldsyntax' command-line options are incompatible

I don't have a clue why it says "lang="vb" becuase it looks like C.  I searched within Tools-Options and was uable to find anything that looks like /clr:oldsyntax

Do you know where to look in Visual Studio 2008 to resolve this problem?

Thank you for taking the time to reply.
 
Share this answer
 
Comments
Sandeep Mewara 24-Oct-10 5:02am    
1. At any time, you can edit/update your question.
2. Use 'Add Comment' feature to respond to an answer.
I think I might be making some progress here. Please clarify something. In the Visual Studio help files there are entries for TCPListener and TCPClient. I don't find anything like TCPServer. Does the TCPListener play the role of server?
 
Share this answer
 
Comments
Nish Nishant 23-Oct-10 20:33pm    
>> Does the TCPListener play the role of server? <<

Yes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900