0 votes
by (120 points)

Hello
We are integrating your dll (HTTPS component) with our soluction and we have found some troubles with the communication that we can't understand.

Our application is developed in .NET with C# in Visual Studio 2005 as device application with Operation System Windows Embebed 5. (For Device Pidion 1300).

We are trying to send any times information to httpsRequest and the two first times it wort fine but when the second call is send the log said: "closing TLS socket" and it cant send more.

I put the log here.

Thank you.

2017-09-25 20:09:52 Opening log file.
2017-09-25 20:09:52 Using FileLogWriter version 2.5.6426.0.
2017-09-25 20:10:47 DEBUG HttpRequest(1)[-984233166] HTTP: Created new HTTP-client (1).
2017-09-25 20:10:48 INFO HttpRequest(1)[-984233166] HTTP: Connecting to 'https://tpvpc.sermepa.es/'...
2017-09-25 20:10:50 INFO HttpRequest(1)[-984233166] TLS: State StateChange:Negotiating
2017-09-25 20:10:50 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:ClientHello was sent.
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:ServerHello was received.
2017-09-25 20:10:51 INFO HttpRequest(1)[-984233166] TLS: Using TLS 1.2.
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: The server supports secure renegotiation.
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:Certificate was received.
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:ServerHelloDone was received.
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: Verifying server certificate ('CN=tpvpc.sermepa.es, OU="REDSYS SERVICIOS DE PROCESAMIENTO, S.L.", O="REDSYS SERVICIOS DE PROCESAMIENTO, S.L.", L=Madrid, S=Madrid, C=ES').
2017-09-25 20:10:51 DEBUG HttpRequest(1)[-984233166] TLS: Certificate verification result: Accept
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:ClientKeyExchange was sent.
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: CipherSpec:ChangeCipherSpec was sent.
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:Finished was sent.
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: CipherSpec:ChangeCipherSpec was received.
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: HandshakeMessage:Finished was received.
2017-09-25 20:10:52 INFO HttpRequest(1)[-984233166] TLS: State StateChange:Secured
2017-09-25 20:10:52 INFO HttpRequest(1)[-984233166] TLS: Connection secured using cipher: TLS 1.2, RSA, 256bit AES in CBC mode, SHA256
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] TLS: Session ID:
0000 |34-FC-6B-F6-B4-E5-41-AA 23-FA-74-DE-6C-90-2A-DA| 4.k...A.#.t.l.*.
0010 |42-A5-92-96-7D-A7-35-7E A2-CE-57-E9-FC-B1-18-2D| B...}.5~..W....-
2017-09-25 20:10:52 INFO HttpRequest(1)[-984233166] HTTP: Sending request: POST /TPVPC/services/SerClsWSPeticionSOAP
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] HTTP: Sending request (271 bytes).
2017-09-25 20:10:52 DEBUG HttpRequest(1)[-984233166] HTTP: Sending data (1007 bytes).
2017-09-25 20:10:54 INFO HttpRequest(1)[-984233166] HTTP: Received response: 200 OK.
2017-09-25 20:10:54 DEBUG HttpRequest(1)[-984233166] HTTP: Received 8 headers.
2017-09-25 20:10:54 DEBUG HttpRequest(1)[-984233166] HTTP: Response Content-Length not specified.
2017-09-25 20:10:54 DEBUG HttpRequest(1)[-984233166] HTTP: Response Transfer-Encoding: chunked.
2017-09-25 20:10:54 DEBUG HttpRequest(1)[-984233166] HTTP: Received content (1438 bytes).
2017-09-25 20:10:56 DEBUG HttpRequest(2)[-984233166] HTTP: Using cached HTTP-client (1).
2017-09-25 20:10:56 INFO HttpRequest(2)[-984233166] HTTP: Sending request: POST /TPV
PC/services/SerClsWSPeticionSOAP
2017-09-25 20:10:56 DEBUG HttpRequest(2)[-984233166] HTTP: Sending request (271 bytes).
2017-09-25 20:10:56 DEBUG HttpRequest(2)[-984233166] HTTP: Sending data (1007 bytes).
2017-09-25 20:10:59 INFO HttpRequest(2)[-984233166] HTTP: Received response: 200 OK.
2017-09-25 20:10:59 DEBUG HttpRequest(2)[-984233166] HTTP: Received 8 headers.
2017-09-25 20:10:59 DEBUG HttpRequest(2)[-984233166] HTTP: Response Content-Length not specified.
2017-09-25 20:10:59 DEBUG HttpRequest(2)[-984233166] HTTP: Response Transfer-Encoding: chunked.
2017-09-25 20:10:59 DEBUG HttpRequest(2)[-984233166] HTTP: Received content (1438 bytes).
2017-09-25 20:11:01 DEBUG HttpRequest(2)[-984233166] TLS: TLS socket was closed, 0 bytes of data were received.
2017-09-25 20:11:01 INFO HttpRequest(2)[-984233166] TLS: State StateChange:Closed
2017-09-25 20:11:01 DEBUG HttpRequest(2)[-984233166] TLS: Closing TLS socket.
2017-09-25 20:11:01 DEBUG HttpRequest(3)[-984233166] HTTP: Created new HTTP-client (2).
2017-09-25 20:11:01 INFO HttpRequest(3)[-984233166] HTTP: Connecting to 'https://tpvpc.sermepa.es/'...
2017-09-25 20:11:01 ERROR HttpRequest(3)[-984233166] HTTP: Error while sending request: Rebex.Net.ProxySocketException: Unable to resolve host name: A socket operation encountered a dead network ---> Rebex.Net.ProxySocketException: Unable to resolve host name: A socket operation encountered a dead network ---> System.Net.Sockets.SocketException: A socket operation encountered a dead network
en System.Net.Dns.ResolveInternal(String hostName)
en System.Net.Dns.GetHostEntry(String hostNameOrAddress)
en System.Net.Dns.ResolveAsyncResult.execute()
en System.Net.Dns.ResolveAsyncResult.execute1(Object unused)
en System.Threading.ThreadPool.WorkItem.doWork(Object o)
en System.Threading.Timer.ring()

Applies to: Rebex HTTPS

1 Answer

0 votes
by (73.6k points)

The System.Net.Sockets.SocketException: A socket operation encountered a dead network is typically caused by unreliable network connection. This is common problem on .NET CF when using dial up connection.

This problem has typically nothing to do with Rebex components. If you use plain system socket, you will encounter the same issue.

This is what we recommend to our users, who use dial up connection:

To connect using a dial up connection from .NET CF on Windows Mobile, you can use Connection Manager functions such as ConnMgrEnumDestinations, ConnMgrEstablishConnection and ConnMgrReleaseConnection. Check out https://msdn.microsoft.com/en-us/library/bb840031.aspx for details. There are no classes available for this in .NET CF, but it can be done quite easily using P/Invoke if you have some experience with this.

But perhaps a better choice is to use the excelent Smart Device Framework by OpenNETCF that contains a wrapper class for the Connection Manager that is extremely easy to use:
https://github.com/ctacke/sdf/tree/master/OpenNETCF.Net/OpenNETCF.Net
It is open source project, so you might either use it as is or as a reference for your own implementation if you prefer.

...