This is a discussion on communication protocol implementation in dotnet - DOTNET ; Hello, I'm implementing a protocol specification in C#.net and get confused with synchronous/asynchronous methods to use for serial and socket programming. The application is not multi-threaded and for each request to send or receive to/from device has 2 sec timeout. ...
Hello,
I'm implementing a protocol specification in C#.net and get confused with
synchronous/asynchronous methods to use for serial and socket programming.
The application is not multi-threaded and for each request to send or
receive to/from device has 2 sec timeout. For this kind of requirement can I
simply use Read() and Receive() methods with setting 2 sec as Read/Write
timeouts or shall I provide operation complete status by using IAsychnronous
to my client.
The same application in VC++ used GetOverlappedResult() in a loop of 2 sec
time to check for operation complete. If call to Read() doesn't get data then
GetOverlappedResult() in the loop fills the buffer when data arrives on port
with in 2 sec.
Please suggest which methods to use in C# for this implementation.
--
Software Engineer