I'm a computer engineer in my final year of studies, hopefully graduating in a couple of months. I'm developing a peer-to-peer application for my fyp, and i'm gonna use ur tcp component to establish the upload/download operations.
The explanation is really clear. There's one point i didn't get though, when u say that the different handlers (Exception, ConnectionFilter and Messages) should be thread-safe. What about it?
I'm not much of a thread user, and i'm keen on having a cleanly working p2p app with no flaws on the socket level.
Thanx for ur component, it came really in handy,
Saint Joseph University
I've tried using your component but i'm having a problem on the client side.
The server is able to receive and send messages (StringData), but the client is not receiving anything.
Basically, i've copied your test example from the website and split it in two parts, one server and the other one client.
I am trying to use XYDispDriver on a StoryRanges collection IDispatch from the MS Word object model. Specifically I do
// ... left out code that attaches the XYDocument object to a Word Document IDispatch
VARIANT *pStoryRanges = XYDocument.GetProperty("StoryRanges");
if (pStoryRanges == NULL || pStoryRanges->vt != VT_DISPATCH || pStoryRanges->pdispVal == NULL)
// Need to AddRef on IDispatch returned from GetProperty
for (long i=Word2007::wdMainTextStory; i<=Word2007::wdEndnoteContinuationNoticeStory; i++)
VARIANT *pStoryRange = XYStoryRanges.InvokeMethod("Item", i);
if (pStoryRange == NULL || pStoryRange->vt != VT_DISPATCH || pStoryRange->pdispVal == NULL)
In the above block of code, the XYStoryRanges.InvokeMethod("Item", i) always returns an Empty. Stepping down into the InvokeMethodV(), I can see that the pArg-> for the single arg "i" is set to 29 or USERDEFINED and there is no case for USERDEFINED in your switch block, so you end up ignoring the arg and the return value from the m_pDisp->Invoke() is
m_hRet 0x80020008 Bad variable type. HRESULT
Do you expect that? Do you have a suggestion for how best to use XYDispDriver to access items from a collection? Should I subclass XYDispDriver and add an Item() method which will do the right marshaling of the index arg?
If A calls SendSyncTextMsg to B and B is busy doing something else, the call will timeout at most. This will happen no matter how they were connected together.
The question is, if A and B are calling SendSyncTextMsg to each other, how is it possible that they can replay to each other and not causing timeout?
The answer is, when a message arrives, the message handler will be invoked. If you wrote the message handler so that it replies to an incoming message, then the handler will be invoked even if you are in the middle of calling SendSyncTextMsg!
This is because when XYMessenger is waiting for a reply to a SendSyncTextMsg call, it can processe other incoming messages, and it can also forward messages between two other XYMessenger objects.
Now it should be clear that if A is waiting for a reply to SendSyncTextMsg call, other XYMessenger objects connected via A will not be stuck because A can still forward messages from one node to the other.
If you call SendSyncTextMsg to XYAdmin and XYRoot, you will not get any reply unless the message is one of the few documented in the help files. XYAdmin and XYRoot will disregard and delete any message they don't want to process.
If you post your code (the sending part), I will take a look.
[Process B] B is the "MANAGER" and logged in as XYAdmin@XXX
private int sendXyRootMessage(String title, String message, int appId,boolean isSave)
// using debugger
// title= "Spotp"
// message = ""
// appId = -2000000001
String strTo = _xySocket.GetParent(); // Using debugger strTo = "XYRoot@"
int reply = _xySocket.SendSyncTextMsg(strTo,title,message,appId,60);
// hangs here. reply is -1 after timeout
int index = _xySocket.GetMsgIndexWithSenderMsgID(reply);
[Process C] is your XYRoot java utility
A is asking B to add a user to C (XYRoot). This is done since only the XYAdmin can add users.
I tried another scenario with A not in the picture. B can add a user to C without any problems when A is not connected at all.
I tried a third scenario where A uses SendTextMsg instead of SendSyncTextMsg and Process B hangs at the same spot.
Maybe this isn't an issue of communication but some caveats that apply to being logged in as XYAdmin and XYRoot? Process A and B(XYAdmin) both connect to C (XYRoot) as clients. A then requests B to add a user to C.
First i would like to thank you for your articles it help me a lot.
Wile trying to use your XYSoapClient.dll ,
if every thing is ok than it is working all right.
but when i try to rase exception like a wrong MethodName
then i get a Soap error print on my crt which does not explain the error
only when setting the .... #define XYDISPDRIVER_DEBUG
i get the print messages on my screen but not getting it back to the XYSoapClientApp
so maybe you can add a check for GetIDsOfNames for the MethodName
and throw your own exception
or lean on the system exception and return the Exception->GetErrorMessage
any way right now i think it is not clear what is the Soap error.
I tried using the DLL from your above article. Installed the xyrunproc OK on MS-SQL 2k. Whenever I try and use it, I get "unable to load DLL or a DLL it references" type message. I did not have Framework on the server (W2K Server) but installing framework 1.1 did not fix the problem.
I would LOVE to be able to use this DLL.