News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
problem with poll  
by Michele Baravalle [ooly at interfree dot it]
posted on 2005/02/21

I'm add ssl functionality on CassiniEx problem but i've a problem...

The source
private int waitForRequestBytes() {
int availBytes = 0;
// Server.Logger.Debug("bhooo" + _socket.Available);
try {
if (_socket.Available == 0) {
// poll until there is data
Server.Logger.Debug("1a");
_socket.Poll(100000 /* 100ms */, SelectMode.SelectRead);
Server.Logger.Debug("1b");
if (_socket.Available == 0 && _socket.Connected)
_socket.Poll(10000000 /* 10sec */, SelectMode.SelectRead);
}
Server.Logger.Debug("1c");
availBytes = _socket.Available;
}
catch {
}

return availBytes;
}

work well without ssl but crash with the ssl support.
Any idea?
Thanks

Michele

by Michele Baravalle [ooly at interfree dot it]
posted on 2005/02/28

OK...i've tested this solutions

private int waitForRequestBytes() {
int availBytes = 0;
int counter = 0;
try {
// Read data in synchronous mode
if (_socket.Available == 0) {
// "poll" until there is data
while(counter < 10){
// Wait 10 ms
System.Threading.Thread.Sleep(10);
if(_socket.Connected)
break;
}
if (_socket.Available == 0 && _socket.Connected){
counter = 0;
while(counter < 1000){
// Wait 10 ms
System.Threading.Thread.Sleep(10);
if(_socket.Available != 0){
// Read all data (after break)
availBytes = _socket.Available;
System.Threading.Thread.Sleep(10);
if(availBytes == _socket.Available){
break;
}
}
}
}
}
availBytes = _socket.Available;
}
catch{
}
return availBytes;
}

by Michele Baravalle [ooly at interfree dot it]
posted on 2005/02/28

OK...i've tested this solutions

private int waitForRequestBytes() {
int availBytes = 0;
int counter = 0;
try {
// Read data in synchronous mode
if (_socket.Available == 0) {
// "poll" until there is data
while(counter < 10){
// Wait 10 ms
System.Threading.Thread.Sleep(10);
if(_socket.Connected)
break;
}
if (_socket.Available == 0 && _socket.Connected){
counter = 0;
while(counter < 1000){
// Wait 10 ms
System.Threading.Thread.Sleep(10);
if(_socket.Available != 0){
// Read all data (after break)
availBytes = _socket.Available;
System.Threading.Thread.Sleep(10);
if(availBytes == _socket.Available){
break;
}
}
}
}
}
availBytes = _socket.Available;
}
catch{
}
return availBytes;
}

by thomas [sunyunzju at sohu dot com]
posted on 2005/03/24

I have met the same problem,I add ssl function to Cassini
...

private int WaitForRequestBytes() {
int availBytes = 0;

try {

if(_socket.Available == 0 ) {
// poll until there is data
_socket.Poll(100000 /* 100ms */, SelectMode.SelectRead);
if (_socket.Available == 0 && _socket.Connected)
_socket.Poll(10000000 /* 10sec */, SelectMode.SelectRead);
}

availBytes = _socket.Available;
}
catch(Exception e) {
throw new Exception(e.Message);
}

return availBytes;
}
work well without ssl but crash with the ssl support.

I read the source code,I found
in the file SecureSocket.cs,the function Poll throw new NotSupportedException("The Poll method is not supported in SSL or TLS mode. Use the asynchronous methods and the Available property instead.");

I have read your solution,but It can't work. do you have any idea to resolve this problem?
thanks


by Michele Baravalle [ooly at interfree dot it]
posted on 2005/09/02

I've modify CassiniEx

If you need i can send the source code

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.