Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

TlsSocket.EndSend() throws System.InvalidCastException

$
0
0

Hello,

I've run into the following issue: whenever I try to finalize an asynchronous send operation with TlsSocket.EndSend(), I get the following exception:


System.InvalidCastException: InvalidCastException
at Rebex.Net.TlsSocket.EndSend(IAsyncResult asyncResult)
at Infrastructure.Communication.SecureTcpClient.SendCallback(IAsyncResult result)
at tlqh.fehz(Object dqv)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()

The code that provokes it looks something like this:

// start asynchronous operation
socket.BeginSend(buffer, 0, buffer.Length, SocketFlags.None, SendCallback, socket);

// ... some lines skipped
private void SendCallback(IAsyncResult result)
{
    TlsSocket socket = (TlsSocket) result.AsyncState;

    socket.EndSend(result);

    //... further processing 
}

I'm using the latest 2018 R1 version of the library under .NET Compact Framework 3.5 on Windows CE.

Could you please help me to solve this issue?
Thanks in advance.


Viewing all articles
Browse latest Browse all 3862

Trending Articles