C# to C++

I have a C# code fragment like:
private void m_btnConnect_Click(object sender, System.EventArgs e)
{
Cursor cursor = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
try
{
// Close the socket if it is still open
if( m_sock != null && m_sock.Connected )
{
m_sock.Shutdown( SocketShutdown.Both );
System.Threading.Thread.Sleep( 10 );
m_sock.Close();
}

// Create the socket object
m_sock = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );

// Define the Server address and port
IPEndPoint epServer = new IPEndPoint( IPAddress.Parse( m_tbServerAddress.Text ), 399 );

// Connect to the server blocking method and setup callback for recieved data
// m_sock.Connect( epServer );
// SetupRecieveCallback( m_sock );

// Connect to server non-Blocking method
m_sock.Blocking = false;
AsyncCallback onconnect = new AsyncCallback( OnConnect );
m_sock.BeginConnect( epServer, onconnect, m_sock );
}
catch( Exception ex )
{
MessageBox.Show( this, ex.Message, "Server Connect failed!" );
}
Cursor.Current = cursor;
and i'm trying to onvert it to C++.It uses System.Net.Sockets.Can someone help with it?
can't you just use CLI/C++? Then it should almost be identical since you can access the .NET framework from there as well. So the same calls etc can be used.
Topic archived. No new replies allowed.