I would like to implement a class, that is able to connect to a server in the internet, send data to it, and receive data from it.
The class derives from CActive, and therefore I encountered some control problems.
When the socket is connected, and when data is sent to the server, everytime the SetActive() method is called.
When the socket is connected and when some login info is sent to the server, I want the application to wait for incoming data from the server calling the RSocket::RecvOneOrMore(...) method. Right after SetActive() is called. Now however, If I want to send data to the server now, I want to cancel the outstanding receiving request by calling Cancel() before RSocket::Write(...).
But then, the application gets stuck (the program does not close, it gets stuck, the screen freezes).
Can anyone please tell me how to handle sending and receiving requests in one class with the CActive architecture?
the String is sent to the server (and received by the server), but right after the application crashes (I believe it's right when the SetActive() method is called. Probably because the active request (receive) has not have been cancelled yet (?)...