|
Forums -> Security Library Forum
Poll method is not supported in SSL or TLS mode |
|
|
by Michael [mpark at springstnet dot com] posted on 2003/11/07 |
|
I'm getting ther error
"The Poll method is not supported in SSL or TLS mode. Use the asynchronous methods and the Available property instead."
How would I implement the Poll method in this case when I'm running in SSL mode?
|
by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2003/11/08 |
|
You can simulate the Poll method by using a ManualResetEvent together with the asynchronous methods and the Available property. Let's say you want to poll for incoming data.
First you create a ManualResetEvent and set its value to false.
Then you'll have to do an asynchronous receive [BeginReceive]. Make sure you pass in a valid byte buffer [the method will throw an exception if you pass a null reference] and also make sure you set the size parameter to 0.
As soon as this method returns, you call the WaitOne method on the reset event with a specific timeout.
In the delegate that you passed to the BeginReceive method, you write some code that sets the reset event [and causes the WaitOne method mentioned above to return].
Once your code returns from the WaitOne method, you can use the Available property to see how many bytes are available. If 0 bytes are available, your timeout has been exceeded. |
by Mike [mpark at springstnet dot com] posted on 2003/11/12 |
|
So I've changed my code a bit so that I'm working with a securenetworkstream, but it looks like the DataAvailable property is not implemented on it.
I tried setting up a 0 byte buffer for the receive method but I get an error in the SecureSocket class at the following line:
return m_Controller.BeginReceive(buffer, offset, size, callback, state);
But I get an argument out of range exception. It doesn't seem to like taking a 0 length byte buffer. |
by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2003/11/15 |
|
Thanks for the tip about the DataAvailable property. It's a new property in v1.1 of the framework, and we hadn't noticed it until now. We'll support it in the next version of the library.
As for the problem with BeginReceive, this is a bug. It too will be fixed in the next version of the library. |
by thomas [sunyunzju at sohu dot com] posted on 2005/03/24 |
|
I have met the same problem,are you resove it now? would you like give me some idea?
thanks |
|
|