EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SSL HTTP Client freezes up Windows Mobile

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 04/10/2008 03:36:57
by Gary Gaughan-Smith (Basic support level)
Joined: 04/10/2008
Posts: 4

HI, we are trying to evaluate SecureBlackBox.NET and are very keen to try and get this working well.
We are using it to communicate with a JavaServlet running under JBoss on Windows 2003 server.

The messaging is simple XML request/response semantics. We are using the Post Method of the Client Class.

We like the speed of of the component over using HttpWebRequest which proved inconsistent. However, we have found that the software freezes up the handheld after a few messages.

We are using the OnData event but would really like to try this in a synchronous manner but we cannot get either the OutputStream, RawOutput or ReceiveData working. ReceiveData returns an error to say the connection does not exist (do we need KeepAlive?). I tries using Open and Close, but could not get Open to work even after setting the host.

Some Questions:
Why might the libarary cause a freeze up of the Mobile Device??
Can we have examples of using Open and Close. What poperties are required to use these.
Can we have examples of using the HTTP Client without using OnData?
How do we detect a dropped connection if we keep a connection alive?

Many Thanks.
We are hoping that this is the answer to our connectivity issues.
Posted: 04/10/2008 07:45:08
by Eugene Mayevski (EldoS Corp.)

Did you try the same code on desktop? I.e. is this problem specific to the device or not? In general, if you post the sample project for your device which exposes the problem, we would be able to diagnose it.

Sincerely yours
Eugene Mayevski
Posted: 04/10/2008 08:41:49
by Gary Gaughan-Smith (Basic support level)
Joined: 04/10/2008
Posts: 4

Here is our actual code. As you see we use an autoWaitevent to synchronise and would prefer to have a synchronous way of getting the response.

using System;
using System.Text;
using System.Threading;
using DotNetHttp;
using SBHTTPSClient;
using SBHTTPSConstants;
using SBSocket;
using SBX509;
using WMPearlInterfaces;
using Unit=SBUtils.Unit;

namespace SecureBlackBoxHttp
/// Implementation of http facade using the .NET SecureBlackBox library

public class SecureBlackBoxHttpFacade : IHttpFacade
private readonly TElHTTPRequestParams tElHTTPRequestParams1 = new TElHTTPRequestParams();
private readonly TElSocketBinding tElSocketBinding1 = new TElSocketBinding();
private readonly TElHTTPSClient HTTPSClient = new TElHTTPSClient();
private readonly CookieHandler cookieHandler = new CookieHandler();

private string data;

private AutoResetEvent autoResetEvent;

public SecureBlackBoxHttpFacade()

HTTPSClient.CertStorage = null;
HTTPSClient.ClientCertStorage = null;
HTTPSClient.HTTPProxyHost = "";
HTTPSClient.HTTPProxyPassword = "";
HTTPSClient.HTTPProxyPort = 3128;
HTTPSClient.HTTPProxyUsername = "";
HTTPSClient.HTTPVersion = TSBHTTPVersion.hvHTTP10;
HTTPSClient.IncomingSpeedLimit = 0;
HTTPSClient.LocalAddress = null;
HTTPSClient.LocalPort = 0;
HTTPSClient.MaxRedirections = 10;
HTTPSClient.MessageLoop = null;
HTTPSClient.OutgoingSpeedLimit = 0;
HTTPSClient.OutputStream = null;
HTTPSClient.PreferKeepAlive = false;
HTTPSClient.RawOutput = null;
tElHTTPRequestParams1.Accept = "";
tElHTTPRequestParams1.AcceptCharset = "";
tElHTTPRequestParams1.AcceptLanguage = "";
tElHTTPRequestParams1.Connection = "";
tElHTTPRequestParams1.ContentRangeEnd = (-1);
tElHTTPRequestParams1.ContentRangeStart = (-1);
tElHTTPRequestParams1.ContentType = "";
tElHTTPRequestParams1.Cookie = "";
tElHTTPRequestParams1.Date = new DateTime(0);
tElHTTPRequestParams1.From = "";
tElHTTPRequestParams1.Host = "";
tElHTTPRequestParams1.Password = "";
tElHTTPRequestParams1.Referer = "";
tElHTTPRequestParams1.UserAgent = "SecureBlackbox";
tElHTTPRequestParams1.Username = "";
HTTPSClient.RequestParameters = tElHTTPRequestParams1;
HTTPSClient.SendBufferSize = 65535;
tElSocketBinding1.LocalIntfAddress = null;
tElSocketBinding1.Port = 0;
tElSocketBinding1.PortRangeFrom = 0;
tElSocketBinding1.PortRangeTo = 0;
HTTPSClient.SocketBinding = tElSocketBinding1;
HTTPSClient.SocketTimeout = 0;
HTTPSClient.SocksAuthentication = 0;
HTTPSClient.SocksPassword = "";
HTTPSClient.SocksPort = 1080;
HTTPSClient.SocksResolveAddress = false;
HTTPSClient.SocksServer = null;
HTTPSClient.SocksUserCode = "";
HTTPSClient.SocksVersion = 1;
HTTPSClient.SRPPassword = "";
HTTPSClient.SRPUserName = "";
HTTPSClient.SSLEnabled = false;
HTTPSClient.Tag = null;
HTTPSClient.UseCompression = false;
HTTPSClient.UseDigestAuth = false;
HTTPSClient.UseHTTPProxy = false;
HTTPSClient.UseNTLMAuth = false;
HTTPSClient.UseSocks = false;
HTTPSClient.UseWebTunneling = false;
HTTPSClient.Versions = (7);
HTTPSClient.WebTunnelAddress = null;
HTTPSClient.WebTunnelAuthentication = 0;
HTTPSClient.WebTunnelPassword = null;
HTTPSClient.WebTunnelPort = 3128;
HTTPSClient.WebTunnelUserId = null;
HTTPSClient.OnData += HTTPSClient_OnData;
HTTPSClient.OnDocumentEnd += HTTPSClient_OnEnd;
HTTPSClient.OnCertificateValidate += HTTPSClient_OnCertificateValidate;
HTTPSClient.OnCookie += HTTPSClient_OnCookie;

public string HttpGet(string url)
return data;

public string HttpPost(string url, string postData)

HTTPSClient.Post(url, postData);
return data;

private void PrepareForRequest()
data = "";

autoResetEvent = new AutoResetEvent(false);

foreach(string name in cookieHandler.CookieNames)
HTTPSClient.RequestCookies.Add(name, cookieHandler.CookieValue(name));

private static void HTTPSClient_OnCertificateValidate(object Sender, TElX509Certificate X509Certificate,
ref bool Validate)
Validate = true;
// NEVER do this in real life since this makes HTTPS security void.
// Instead validate the certificate as described on http://www.eldos.com/sbb/articles/1966.php

private void HTTPSClient_OnData(object Sender, byte[] Buffer)
data+= Encoding.Default.GetString(Buffer, 0, Buffer.Length);

private void HTTPSClient_OnEnd(object Sender)

private void HTTPSClient_OnCookie(object Sender, string CookieText)

Posted: 04/10/2008 08:59:26
by Eugene Mayevski (EldoS Corp.)

I am sorry but we need a runnable project that we could test.

Also, does your code work on desktop?

Sincerely yours
Eugene Mayevski
Posted: 04/10/2008 09:06:35
by Gary Gaughan-Smith (Basic support level)
Joined: 04/10/2008
Posts: 4

Without writing something that's a bit difficult. There's some 40 projects in the solution.
Yes it works on the desktop.

In that case, can you just suggest a way of not using autoResetEvents to synchronise when the data is returned. We would like to use OutputStream or ReceiveData but neither work (neither return any data).

Many thanks
Posted: 04/11/2008 01:44:09
by Eugene Mayevski (EldoS Corp.)

Ok ... we will create a test project on our side and see what might be wrong. A couple of questions to help us create a project:
1) are you using .NET CF 1.1 or .NET CF 2.0?
2) Are you testing on device or on emulator?
3) Is it Windows Moble 5 or Windows Mobile 6 (or older Windows Mobile 2003)?

Sincerely yours
Eugene Mayevski
Posted: 04/11/2008 02:30:52
by Gary Gaughan-Smith (Basic support level)
Joined: 04/10/2008
Posts: 4

1) .NET 2.0 SP2
2) Device Symbol MC9094 WM
3) Windows Mobile 5

Many Thanks
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.



Topic viewed 3030 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!