by Demez Christophe [cdemez2 at hotmail dot com] posted on 2006/01/27 |
|
Hi... Here is what I do
-----------------------
1 - Client : BeginSend : "MESSAGE1"
2 -
a.Server receive "MESSAGE1" and ask to start TLS
b.Send MESSAGE: "START TLS"
3 - Client Receive : "START TLS"
4 - Client : ChangeSecurityProtocol( TLS )
5 - Client : EndSend "CallBack"
!! NullReferenceException
Why it is strange ?
-------------------
Server has completely receive client message, and send a response message to client.
The "EndSend" callback even AFTER we receive the server message !!
A solution :
------------
Class : SecureSocket
Method : EndSend(...)
I add this :
if (ti == null)
return base.EndSend(asyncResult)
and remove :
if (ti == null)
throw new ArgumentException();
Explaination:
--------------
I cannot synchronise the Send, it has no sense !!! (Asynchrone Send is FASTER)
Then with this code, if we receive a "normal" IAsyncResult, we process it normally.
Please, tell me if it is correct ? |