Subject: socketException
Socket exception is rising when my app switches from background to foreground.
I found that OnClose event is not firing every time app comes to foreground. Trying to send a packet in that case leads socketException.
The stacktrace of the exception is as follows.
StackTrace:
System.Net.Sockets.SocketException was unhandled
Message=A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
ErrorCode=10057
StackTrace:
at Matrix.Net.ClientSocket.Send(Byte[] data)
at Matrix.XmppStream.?(String ?)
at Matrix.XmppStream.?(String ?)
at Matrix.XmppStream.SendStreamHeader()
at Matrix.XmppStream.3q2mzyj4wtv734ttjnj6bnrw7kquujzy? ??(Object ?, EventArgs ?)
at Matrix.Net.BaseSocket.FireOnConnect()
at Matrix.Net.ClientSocket.?(Object ?, SocketAsyncEventArgs ?)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.Socket.AsyncCallback(IAsyncResult ar)
at System.Net.LazyAsyncResult.InvokeCallback(Boolean asyncCompletion)
at System.Net.Sockets.Socket.SocketAsyncRequestManager.WorkerThread.doWork()
at System.Net.Sockets.Socket.SocketAsyncRequestManager.WorkerThread.doWorkI(Object o)
at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()
Using BOSH transportation, it works fine. It only occurs while using socket transportation.
I found that OnClose event is not firing every time app comes to foreground. Trying to send a packet in that case leads socketException.
The stacktrace of the exception is as follows.
StackTrace:
System.Net.Sockets.SocketException was unhandled
Message=A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
ErrorCode=10057
StackTrace:
at Matrix.Net.ClientSocket.Send(Byte[] data)
at Matrix.XmppStream.?(String ?)
at Matrix.XmppStream.?(String ?)
at Matrix.XmppStream.SendStreamHeader()
at Matrix.XmppStream.3q2mzyj4wtv734ttjnj6bnrw7kquujzy? ??(Object ?, EventArgs ?)
at Matrix.Net.BaseSocket.FireOnConnect()
at Matrix.Net.ClientSocket.?(Object ?, SocketAsyncEventArgs ?)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.Socket.AsyncCallback(IAsyncResult ar)
at System.Net.LazyAsyncResult.InvokeCallback(Boolean asyncCompletion)
at System.Net.Sockets.Socket.SocketAsyncRequestManager.WorkerThread.doWork()
at System.Net.Sockets.Socket.SocketAsyncRequestManager.WorkerThread.doWorkI(Object o)
at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()
Using BOSH transportation, it works fine. It only occurs while using socket transportation.
Geetha
Show profile
Link to this post

MatrixException.zip 378.4 kBytes