Password Protected Session for p2p worked but partially, how to get it done properly?

Started by
3 comments, last by Ejaz 20 years, 8 months ago
Hi, I''m trying to create a p2p connection with password protection. As the SDK states, I did the same, and the good thing is, it worked. Fine, but then I figure out one more issue. Actually, if I supply correct password while setting the application desc. of host & peers, then everything goes as it is suppose to be, BUT, if I provide incorrect passwords for host & peers, while establishing the connection, the connection to the host won''t get established, but the return value of the IDirectPlay8Peer::Connect(...) is the same as it is in case of unique passowrds for host & peers. So, now the problem for me, if the connection got successfully established I greet the users, fine, but if the user won''t get connected properly, first I get the welcome message (becoz I receive same value for SUCCESSED(hr) in return), then no communication get done b/w the peers. Any solution for this problem will be highly appriciated & thanx in advance. Regards, Ejaz.
Advertisement
> the return value of the IDirectPlay8Peer::Connect(...) is the same

It means the code executed correctly and the connection request has been posted (assuming async ops). You will receive later the message DPN_MSGID_CONNECT_COMPLETE with the actual error code and other connection info if any. That can take from a few milliseconds on a local net when connection occurs, to a few seconds when the remote machine is down.

-cb
So, The saviour is here, thanx for the respone dear cbenoi1.

Ok so I guess what I should do now is, implement DPN_MSGID_CONNECT_COMPLETE in the direct play message handler and in case of IDirectPlay8Peer::Connect(...), when I get success signal, I just display some message that the connection established but verification is in process.

After that, when the DPN_MSGID_CONNECT_COMPLETE will be signals, if everything goes fine, then I dispaly connection established successfully message and if it didn''t get established, then I post another message about the error that might occur (most probably it will be invalid password for the session to connect).

So, what do u suggest cbenoi1, am I on the right track or should I change the implementation in some other way.

And thanx again for ur reply. It really clear many doubts.

Regards,

Ejaz.
You could pop a modeless dialog box with a some text indicating that connection is in progress, some timer with elapsed time (using WM_TIMER), and a ''Cancel'' button. You did get a DPNHANDLE with the Connect() call, so you can use it to cancel the connection request (using CancelOperation() ) if the user become too impatient.

> The saviour is here

I had the same problems you''re having 6 - 9 months ago. At the pace you''re hitting the bumps, you''ll catch me by December and by then I''ll be the one asking the questions!

-cb
> you''ll catch me by December

December is too far away and I guess u''ll move much ahead. Thanx for the suggestion anyways dear.

Regards,

Ejaz.

This topic is closed to new replies.

Advertisement