tags:

views:

25

answers:

1

Add next changes:

Emily::oSeMac^ Terminal;
    Emily::AsyncSocketController^ _socketManager;
    delegate void DataArrival(String^, array<unsigned char, 1>^, System::Net::IPEndPoint^);

    void _socketManager_onDataArrival(String^ SocketID, array<unsigned char, 1>^ SocketData, System::Net::IPEndPoint^ RemoteIP)
    {
        System::Object^ retData = Terminal->WhoCame (SocketID, SocketData, RemoteIP, _socketManager, 0); 
    }
    Form1(void)
    {
        InitializeComponent();
        _socketManager = gcnew Emily::AsyncSocketController(2000);
        _socketManager->onDataArrival += gcnew DataArrival(this, &AC_WebPassManager::Form1::_socketManager_onDataArrival);
        _socketManager->Start();
        Terminal = gcnew Emily::oSeMac();
    }

Error error C2664: 'Emily::AsyncSocketController::onDataArrival::add' : cannot convert parameter 1 from 'AC_WebPassManager::Form1::DataArrival ^' to 'Emily::AsyncSocketController::onDataArrivalEventHandler ^' 1> No user-defined-conversion operator available, or 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>

+1  A: 
Alex Farber
OK, I change codeEmily::oSeMac^ Terminal;Emily::AsyncSocketController^ _socketManager;public: delegate DataArrival(String^, array<unsigned char, 1>^, System::Net::IPEndPoint^);void _socketManager_onDataArrival(String^ SocketID, array<unsigned char, 1>^ SocketData, System::Net::IPEndPoint^ RemoteIP) {System::Object^ retData = Terminal->WhoCame (SocketID, SocketData, RemoteIP, _socketManager, 0); }
Form1(void) { InitializeComponent(); _socketManager = gcnew Emily::AsyncSocketController(2000); _socketManager->onDataArrival += gcnew DataArrival(this, _socketManager->Start(); Terminal = gcnew Emily::oSeMac(); }
Errors1>d:\projects\ac_webpassmanager\ac_webpassmanager\Form1.h(36) : error C2146: syntax error : missing ';' before identifier 'DataArrival'1>d:\projects\ac_webpassmanager\ac_webpassmanager\Form1.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\projects\ac_webpassmanager\ac_webpassmanager\Form1.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\projects\ac_webpassmanager\ac_webpassmanager\Form1.h(36) :
warning C4183: 'DataArrival': missing return type; assumed to be a member function returning 'int'1>d:\projects\ac_webpassmanager\ac_webpassmanager\Form1.h(46) : error C2061: syntax error : identifier 'DataArrival'
Your comments are unreadable, please edit original question and describe the problem there.
Alex Farber
Sorry, already edit
Regarding DataArrival delegate: it must be already defined somewhere, AsyncSocketController::onDataArrival event has this type. Find this delegate in the library you are using, and use actual delegate name instead of DataArrival.
Alex Farber
No, It must be my delegate, because I must add my code in this delegate. For exanple, when I call some function from library than when library get all data from controller then I must parse this data. I have demo code but on VB .NET
Emily::AsyncSocketController::onDataArrivalEventHandler is required delegate type. Remove DataArrival definition and write:_socketManager->onDataArrival += gcnew Emily::AsyncSocketController::onDataArrivalEventHandler(this,
Alex Farber
Thank you!!! It's compile.
Fine. Since you are new user, possibly you don't know that accepting the answer is done by clicking the "v" button near the answer. This is not intuitive, I found this only after asking my first 10 questions in this forum :)
Alex Farber
where are you from?