Click to See Complete Forum and Search --> : c++/cli asynchronous socket


POla
March 10th, 2008, 07:14 AM
original error:

error C3867: 'ServerChat::Form1::OnClientConnect': function call missing argument list; use '&ServerChat::Form1::OnClientConnect' to create a pointer to member

the function is like this void OnClientConnect( IAsyncResult^ ar){};

By doing AsyncCallback(&Form1::OnClientConnect) the error seem like solved but an error happen like this:

error C3352: 'void ServerChat::Form1::OnClientConnect(System::IAsyncResult ^)' : the specified function does not match the delegate type 'void (System::IAsyncResult ^)'
-it look exactly same type but came out an error.

then i try put static void OnClientConnect( IAsyncResult^ ar) and the error gone seem to be solved but the static cause some new error like this:

error C2227: left of '->Text' must point to class/struct/union/generic type
-richTextBoxRcvMsg->Text by right should be no problem.

error C2227: left of '->EndAccept' must point to class/struct/union/generic type
-m_Socket->EndAccept(ar) by right should be no problem.

Can somebody help to explain what is happening and come out a solution to this pls? It is important to me, thanks.

darwen
March 10th, 2008, 03:00 PM
Try no static but


AsyncCallback(this, &Form1::OnClientConnect)


You could do with understanding the difference between a static and a non-static (instance) method too... go and look it up :D

Darwen.

POla
March 12th, 2008, 11:15 PM
Try no static but


AsyncCallback(this, &Form1::OnClientConnect)


You could do with understanding the difference between a static and a non-static (instance) method too... go and look it up :D

Darwen.

Thanks to you, Darwen. It is solved.