Simple program...
First Application have TCPServer. Second Application have TCPClient. Start Debug. Start Server and Client on localhost.
On CONNECT - all OK. But! When my Client DISCONECT from my Server (or Server shutdown), then take ERROR:
@System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System"
StackTrace:
at System.Net.UnsafeNclNativeMethods.OSSOCK.WSAGetOverlappedResult(SafeCloseSocket socketHandle, IntPtr overlapped, UInt32& bytesTransferred, Boolean wait, IntPtr ignored)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)...
PLEASE, help...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1- Try to build the *whole* project (including the demos) as Release and not Debug.
2- Try to run the TCP client and server demos and see if you have the same errors.
Note: I believe the errors should be gone since the try/catch statements should prevent them. Please, let me know the results you get up to this point.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I run the TCP client and server demos outside VS. Result - Windows Error MessageBox (Ошибка приложения : Инструкция по адресу "0x20b0d0d9" обратилась к памяти по адресу "0x00000000". Память не может быть "written".) - I used Russian Windows XP SP2... After MessageBox Server is close....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I really would like to help you. But I can't find a way to force this error in any of my computers.
I tried it on Windows XP and 2000. I even created another tcp client to connect and disconnect from the tcp server 1.000 times and got no error.
The only thing I still did not do is to build the whole package in VS 2005. I am using Visual C# 2005 Express. I will get VS 2005 at work soon. Then I will make more tests.
Sorry for the inconvenience. I will continue trying and when I find the solution I will update the package.
Please, let me know if you find a solution (or if you can isolate the problem).
Kind regards,
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
KiBERMiKE, This is an error that is called when trying to read/write to a stream/socket when the stream/socket doesn't exist. Error catch using Try Catch and wrap that with an If statement.
The if statement to see if the socket/stream is be read/written is
objNetworkStream.CanRead = True
CanRead and CanWrite return a bool value that you can check to see if the client is connected (or if you have been disconnected from the server).
If this check returns false, log out because the stream or socket has been closed.
Hope this helps
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Simple program...
First Application have TCPServer. Second Application have TCPClient. Start Debug. Start Server and Client on localhost.
On CONNECT - all OK. But! When my Client DISCONECT from my Server (or Server shutdown), then take ERROR:
@System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System"
StackTrace:
at System.Net.UnsafeNclNativeMethods.OSSOCK.WSAGetOverlappedResult(SafeCloseSocket socketHandle, IntPtr overlapped, UInt32& bytesTransferred, Boolean wait, IntPtr ignored)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)...
PLEASE, help...
Message for this error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
The error you found is really strange.
Could you please confirm that you are using .NET 2.0 to build the TCPComponents.NET and its sample applications?
Kind regards,
Mike
I using MS Visual Studio 2005 C# + .NET 2.0. Default options. This ERROR show up also if i using your sample applications...
Let's try something else:
1- Try to build the *whole* project (including the demos) as Release and not Debug.
2- Try to run the TCP client and server demos and see if you have the same errors.
Note: I believe the errors should be gone since the try/catch statements should prevent them. Please, let me know the results you get up to this point.
Just one more thing. After building the *whole* project (including the demos) as Release, please run the TCP client and server demos outside VS.
I run the TCP client and server demos outside VS. Result - Windows Error MessageBox (Ошибка приложения : Инструкция по адресу "0x20b0d0d9" обратилась к памяти по адресу "0x00000000". Память не может быть "written".) - I used Russian Windows XP SP2... After MessageBox Server is close....
I really would like to help you. But I can't find a way to force this error in any of my computers.
I tried it on Windows XP and 2000. I even created another tcp client to connect and disconnect from the tcp server 1.000 times and got no error.
The only thing I still did not do is to build the whole package in VS 2005. I am using Visual C# 2005 Express. I will get VS 2005 at work soon. Then I will make more tests.
Sorry for the inconvenience. I will continue trying and when I find the solution I will update the package.
Please, let me know if you find a solution (or if you can isolate the problem).
Kind regards,
Mike
And.... How progress?
KiBERMiKE, This is an error that is called when trying to read/write to a stream/socket when the stream/socket doesn't exist. Error catch using Try Catch and wrap that with an If statement.
The if statement to see if the socket/stream is be read/written is
objNetworkStream.CanRead = True
CanRead and CanWrite return a bool value that you can check to see if the client is connected (or if you have been disconnected from the server).
If this check returns false, log out because the stream or socket has been closed.
Hope this helps
Are You complete the component?