How the Hell do I get Visual C .net to open a TCP socket connection - TechRepublic
Question
December 15, 2008 at 03:16 PM
keechow

How the Hell do I get Visual C .net to open a TCP socket connection

by keechow . Updated 17 years, 7 months ago

What is a “Bullet-proof” method of setting up a SOCKET using Visual C++.net??? I’ve been trying to run it with my code but I KEEP getting an ERROR when it RUNs. The code is as follows:

String^ remoteName = “localhost”;

Socket^ clientSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp );
System::Net::IPAddress^ ipAddress = System::Net::Dns::GetHostEntry(“localhost”)->AddressList[0];
IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress, 1800 );
clientSocket->Connect( ipEndPoint );

I’m using Visual C++.net on Visual Studio.net 2005 Frameworks (3.0).

*** Note: ***
I can NOT use the “Dns::Resolve” command since its been obsoleted…

This discussion is locked

All Comments