EldoS | Feel safer!

Software components for data protection, secure storage and transfer

75778 and 75777 error on WinMo

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#14526
Posted: 09/22/2010 02:15:13
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

Hi,
I have an app that runs on WinMo and implements an ElClientSSLSocket

Following connection, I call begin send and begin receive in separate threads (one dedicated to sending and the other receiving). The socket works well for several hours then, following a call to begin send I got:
[ErrorCode=75778] [Fatal=True] [Remote=False]

Following this, I called CloseSocket to shut it down and start a new one but got this error (have seen this several times before)
[ErrorCode=75777] [Fatal=True] [Remote=False]

Following this, I was unable to create any more new sockets that would actually connect!?
They got as far as SSL validate cert callback but after 10 seconds never completed and so my code closed the socket.

Could you please advise on either how to deal with one of these situations or how to prevent it in the first place.

Note: my begin send thread runs a loop taking messages off a Q, sending and blocking on the and endSend interlock to prevent sending the socket more than one begin send message at a time.

Many thanks,
Shaun
#14527
Posted: 09/22/2010 02:30:38
by Eugene Mayevski (EldoS Corp.)

1) Please check if the same code works correctly on desktop.

2)
Quote
Shaun OM wrote:
Following this, I was unable to create any more new sockets that would actually connect!?


Not sure that I understand the statement. Do you want to reuse the same ElClientSSLSocket after calling CloseSocket method? Try creating a new socket object for each connection, this should eliminate the problem.


Sincerely yours
Eugene Mayevski
#14528
Posted: 09/22/2010 02:43:51
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

>>Try creating a new socket object for each connection
Sorry, my posting was not clear. I do create a new socket for each instance.
This is why i'm confused that following the 75777 error on one socket that no other sockets that i instantiate can successfully connect either !?

Note: My application needs to maintain a connection to a server, constantly uploading and downloading data. If a socket stops receiving data or encounters an error then it is closed down and a new one started.


>>Please check if the same code works correctly on desktop.
I could only find code for ELSecureClient and TElSimpleSSLClient

Thanks
Shaun
#14532
Posted: 09/22/2010 06:41:25
by Ken Ivanov (EldoS Corp.)

Thank you for the details.

Could you please put a breakpoint inside the OnError event handler and get a call stack of both exceptions?

Quote
>>Please check if the same code works correctly on desktop.
I could only find code for ELSecureClient and TElSimpleSSLClient

Eugene actually suggested to run your code on desktop PC (not Windows Mobile platform) and check whether it exposes the same problems. Would it be technically possible for you?
#14534
Posted: 09/22/2010 07:04:52
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

I'm not able to try on desktop app as this is all built for .NET CF 3.5

I will however run it with the debugger attached and see if i can capture the event. If I can then will post the details back ASAP but could take several hours to manifest.

Whilst looking at my onError code, I notice that I try and call CloseSocket from there also. This means that there could be 2 threads each calling CloseSocket - dont know if that's of interest - either way, have eliminated one of them for now and it wouldnt prevent the first 75778 error event occuring.

Will post back results as and when i have them
Thanks
Shaun
#14537
Posted: 09/22/2010 11:21:35
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

Hi,
I have been running it and got the 75777 error again:
Code
[CLIENT_SESSION]{7}: Socket Error event (will now stop)!! [ErrorCode=75777] [Fatal=True] [Remote=False]
9/22/10 5:02:13 PM   [CLIENT_SESSION]{7}: Socket Error Event STACK TRACE :   at ClientSession.myClient_OnError(Object Sender, Int32 ErrorCode, Boolean Fatal, Boolean Remote)
   at SecureBlackbox.SSLSocket.Client.ElClientSSLSocket.OnSecureClientError(Object sender, Int32 errorCode, Boolean fatal, Boolean remote)
   at SBClient.TElSecureClient.DoError(Int32 ErrorCode, Boolean Fatal, Boolean Remote)
   at SBClient.TElSecureClient.AnalyzeBuffer()
   at SBClient.TElSecureClient.DataAvailable()
   at SecureBlackbox.SSLSocket.Client.ElClientSSLSocket.DataAvailable()
   at SecureBlackbox.SSLSocket.ElSSLSocket.OnSocketReceiveCallback(IAsyncResult asyncResult)
   at System.Net.LazyAsyncResult.InvokeCallback(Boolean asyncCompletion)
   at System.Net.Sockets.Socket.WorkerThread.doWork()
   at System.Net.Sockets.Socket.WorkerThread.doWorkI(Object o)
   at System.Threading.ThreadPool.WorkItem.doWork(Object o)
   at System.Threading.Timer.ring()


Again, beyond this point, any new sockets that were created failed to get past the Validate Callback and progress to a complete the connection (within 20 seconds at lest)

Please let me know what you think (even if a bit speculative at this stage)
Thanks
Shaun
#14538
Posted: 09/22/2010 11:48:02
by Ken Ivanov (EldoS Corp.)

Thank you for the details. Could you please provide a small clarification -- do you create new BeginSend() and BeginReceive() threads for each new socket instance, or the same threads are re-used?
#14539
Posted: 09/22/2010 12:16:00
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

No problem,

Your answer in short is: I create new BeginSend and BeginReceive threads for each socket - they are not reused.

I have a class called ClientSession (ClientSession creates an instance of ElClientSSLSocket (myClient))
and one called ClientSessionManager

The ClientSessionManager creates an instance of the clientSession every time it wants to attempt a connection and stores it as a local variable. The session manager lives for the duration of the application. The ClientSessions are created every time a new connection attempt is required (usually because the previous one failed).

The clientSession kicks off its own connect, read, write and stop threads. These are held in global scope ClientSession variables. Read and write run in constant loop whilst the socket is connected. Each will make a call to their respective begin method eg myClient.BeginReceive and then wait on an interlock triggered in the read callback

Below is an abbreviated version of my code from ClientSession

Code
while(socketConnected)
{
    resetEventAsyncReadCompleted.Reset();
    IAsyncResult ar = myClient.BeginReceive(readBuffer, 0, readBufferSize, new AsyncCallback(ReadCallback), myClient);
    resetEventAsyncReadCompleted.WaitOne();
    Thread.Sleep(10);
}

Code
private void ReadCallback(IAsyncResult ar)
{
    try
    {
        bytesRead = myClient.EndReceive(ar);
    }
    finally
    {
        resetEventAsyncReadCompleted.Set();
    }
}


Hope this helps,
Shaun
#14540
Posted: 09/22/2010 13:47:20
by Ken Ivanov (EldoS Corp.)

Thank you for the detailed explanation, now the picture is more or less clear.

Probably, the last two questions needed to try to reproduce the issue here in our environment:
1) Did you have a chance to notice whether the 75777 error occurs under certain conditions (e.g., after a certain amount of data or messages being exchanged, or maybe after a certain session alive period)?
2) What is the nature of the data being transferred -- i.e., the size of each particular message, the number of messages per minute, the bandwidth of the channel?
#14541
Posted: 09/22/2010 14:39:01
by Shaun OM (Standard support level)
Joined: 08/10/2010
Posts: 12

1) I haven't managed to pick up a trend yet. It doesn't appear to be time based. My inclination would be data or volume of data based.

2) The data is text info sent as a byte array.
There are 2 byte arrays one of 3bytes and one of approx 120 bytes
I noticed that the first time it happened in my trial was after a surge in data that caused 2 lots of 2048bytes (the buffer size) to be received.

I could send you a log file that shows every instance of socket restart and all data sizes received. Could also send you the ClientSession class - let me know where to email/upload if you need them

Note: When a socket fails I attempt to close it down and then create a new one (new instance of ClientSession). This process repeats every few seconds continually. with each new one i create failing to connect and so being closed down. The sockets do eventually start to connect and receive again after the 75777 error.
In my test file, I received data for about 1:10 hrs, got 75777 error
1.5 minutes later, (after several sockets failed to connect) a socket connected and started receiving. That socket continued to receive for 1:40 hrs until I got the 75777 again. This time the subsequent sockets failed to reconnect. I stopped the app after about 3 futher failed reconnects (4 minutes).

Happy to supply more info as it's critical that I get this resolved.
Many thanks,
Shaun
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

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