I have some legacy code using a CAsyncSocket derived class. This class overrides OnReceive
and it also has a wrapper around SendTo. The code is in a dll which multiple applications will be using on the same PC, all ports are hard coded.
I'm guessing that I need to provide synchronization in the form of a named mutex (CMutex in MFC) class bit I'm not sure.
Should I lock a named mutex in the OnReceive and a different named mutex in the Send methods of CMyAsyncSocket?
Do I need synchronization at all or will the MFC CAsyncSocket do that for me? Worried about accessing a socket on multiple processes.
The underlying socket will provide connection isolation so you don't need to worry about protecting each processes connection. Assuming you just have one thread using the socket in each process you just need to handle the blocking issues which can occur with AsyncSocket, ie when the socket is not ready to deal with the request ?