Hi,
I have developed an application using an overridden CAsyncSocket class to acquire data from a server. Now I need to get data from more than a single server. If I use multiple sockets for the client, I don't know how to distinguish which socket's OnConnect( ), OnSend( ) etc events are called. Is there some kind of way to identify the individual sockets? I tried adding an id datamember to the derived class and initialise it whenever I create and connect a new socket. But I still dont know how to retrieve its value in the OnConnect( ) etc as they seem to be event handlers and use if the "this" pointer doesn't work as they aren't member functions.
.... But I still dont know how to retrieve its value in the OnConnect( ) etc as they seem to be event handlers and use if the "this" pointer doesn't work as they aren't member functions....
I'm not really certain that I understand your question. In fact, the OnXxxx functions like OnSend and OnConnect are indeed member functions for which the "this" pointer should serve to distinguish one object from another.
Could you try explaining your question in a different way?
Hi Mike,
Sorry my mistake. I meant to say that those On..() are called explicitly by the framework to notify the respective events.
I use 2 sockets in my client application to connect to 2 servers. I am able to send data from them to the servers requesting for responses.
At the servers, I am able to receive the requests and I reply with whatever data is requested.
Now comes my problem. At the client side, OnReceive() , I either keep getting a failed assertion or nothing. I use my own class MySocket derived from CAsyncSocket and declare objects of MySocket in the doc file of the app. And which socket object to use for the Receive function inside OnReceive() ?
Hi,
I have attached a sample application which is a part of my actual application. In this app, OnReceive never seems to get called on the client side. I run a sample app on the server which sends back the system time at the server.
This is similar to the scenario of my actual app.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.