and timeout

  • The TcpClient class seems ideal to use for TCP/IP communication but there's one problem I don't see how to work around:

    TcpClient.GetStream returns a NetworkStream for read/write but stream.Read hangs forever if no data is available (although the documentation says it shouldn't). Now, there are both tcpClient.ReceiveTimeout and NetworkStream.ReceiveTimeout properties but for both of these Microsoft has this to say:

    In .NET Compact Framework applications, the ReadTimeout property is supported, but reserved for future use. Using this property will raise an InvalidOperationException, until it is available in a future release of the .NET Compact Framework.

    Which means that there is no timeout functionality in Compact Framework. If that is really the case, it makes TcpClient almost useless and I find that hard to believe.

    Do you have any experience with this or know how work around it?

    Please note: property NetworkStream.DataAvailable always returns False (Microsoft says that it's not always supported)

  • Hello,
    Michael Koster, guess following (refer: Smart Device Development forums -> .NET Compact Framework, for details click here):

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.