EldoS | Feel safer!

Software components for data protection, secure storage and transfer

"Wrong socket state 4 in SetAddress (error code is 96258)"

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#31263
Posted: 11/03/2014 13:30:05
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

First, I've reviewed all the present entries in the forum regarding this error and having managed to solve my problem.

I'm using Delphi XE6 and the VCL Client product. I'm building an XML request in my code that I'm trying to send it. I'm not familiar with the SBB product so I'm guessing it's something I'm doing wrong. Essentially, I'm attempting the following:

XMsg contains my XML request.

...
Code
    aStream := TMemoryStream.create;
    url_act := 'https://' + DW_Primary_URL;
    SetString(XMsg, PAnsiChar(@PB.Buff[0]), PB.Idx);
    StrTemp := TStringList.Create;
    StrTemp.Clear;
    StrTemp.Add(XMsg);
    StrTemp.SaveToStream(aStream, TEncoding.UTF8);
    with HTTPClient do
    begin
      RequestHeaders.Add(XML_API_HDR);
      HTTPVersion := hvHTTP11;
      SSLEnabled := True;
      UseSSLSessionResumption := True;
    end;
    try
      aStream.Position := 0;
      XCode := HTTPClient.Post(String(url_act),aStream,False);
    except
      on E: Exception do
      begin
        Err := TStringList.Create;
        Err.Add(E.Message);
        Err.SaveToFile('Exceptions.txt');
        Err.Free;
      end;

...

The post is generating an exception "Wrong socket state 4 in SetAddress (error code is 96258)".

Am I missing any required settings or have I made settings that I should have?

Any advice will be greatly appreciated.

Regards,

Jack
#31264
Posted: 11/03/2014 13:36:00
by Eugene Mayevski (EldoS Corp.)

The code should work. Does the error happens on the first attempt to call Post or only on the second and consequent attempts?


Sincerely yours
Eugene Mayevski
#31265
Posted: 11/03/2014 13:40:32
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

It happens on every attempt.

The code is getting an upgrade. It was working fine with Winshoes and OpenSSL. The code is being executed within a thread and the Winshoes/OpenSSL has a limit on concurrency that we are hoping to surpass with SBB.
#31266
Posted: 11/03/2014 14:02:49
by Eugene Mayevski (EldoS Corp.)

It should not happen on the first attempt, that's for sure. Please try one of our HTTP samples in Samples\Delphi\HTTPBlackbox\Client folder and see how they behave. Also it would be great if you could reproduce the issue on some compileable test case and if it happens there post the project to the HelpDesk.

BTW you mentioned threads - I assume that you create a separate instance of TElHTTPSClient for each thread, don't you?


Sincerely yours
Eugene Mayevski
#31267
Posted: 11/03/2014 14:05:42
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

Yes, I'm using a threadpool model. Each thread creates it's own instance of the TElHTTPSClient and frees it upon thread termination. I'll try running the samples you referenced and response shortly.
#31268
Posted: 11/03/2014 14:13:16
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

Interesting, each of the sample projects in C:\Users\Public\Documents\EldoS\SecureBlackbox.VCL\Samples\Delphi\HTTPBlackbox\Client folder compile without errors but upon executing them, there is an exception dialog.

---------------------------
Error
---------------------------
Runtime error 217 at 005F63CB
---------------------------
OK
---------------------------
#31269
Posted: 11/03/2014 14:28:11
by Eugene Mayevski (EldoS Corp.)

Preliminary tests with the GET sample compiled with SBB source code didn't expose any problems (tested on Delphi 7 and Delphi XE5). So let's narrow down the problem:

1) are you using precompiled version with the license key or you have compiled the source code available to licensed customers?
2) are you targeting Win32 or Win64 platform?
3) what platform is the code actually run (Win32 or Win64)?


Sincerely yours
Eugene Mayevski
#31270
Posted: 11/03/2014 14:31:58
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

[QUOTE]

1. Pre-compiled with the license key.
2. Win32
3. Win64
#31272
Posted: 11/03/2014 15:14:11
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

-- UPDATE --

Hi Eugene,

I noticed that there was an update to version 12 recently. I installed it, rebuilt the application and now I'm getting a different exception.

Connection failed due to error (75777) (error code is 75777)
#31273
Posted: 11/03/2014 15:19:31
by it it (Standard support level)
Joined: 08/28/2014
Posts: 13

... and just set UseSSLSessionResumption := False;

Now I'm getting:

"Certificate validation handler is not assigned. Please handle the OnCertificateValidate event and implement proper certificate validation code there."

I think the I'm past the worst of it. I may just need to assign a procedure to the OnCertificateValidate event. :)
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 1952 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!