SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 209 | Next

Jan Axelson

"Serial Port Complete: COM Ports, USB Virtual COM Ports, and Ports for Embedded Systems"


Peek and ReadToEnd are methods that might appear useful but in reality aren??™t
practical for most COM-port applications.
Peek returns the next value in the stream without removing the value from the
stream or returns -1 if no character is available. The method can be useful when
reading from resources such as files but is less helpful in COM-port applications
that send data continuously. When the buffer is empty, Peek returns -1
but then continues to return -1 even after more characters have arrived at the
port.
ReadToEnd returns a String containing everything from the current position to
the end of the stream. The stream normally has no way of knowing when it has
reached the end of a particular block of COM-port data. (When reading from a
StreamWriter object, ReadToEnd returns when the StreamWriter object closes.)

Users often find it convenient when an application remembers and selects the
port used the last time the application ran. One way to save parameters is to
store them in the system registry using the RegistryKey class in the
Microsoft.Win32 namespace. The .NET Framework provides another option
in the Application Settings architecture, which enables storing and retrieving
settings in files that don??™t clog the registry.
1   

The System.Configuration namespace includes the AppSettingsSection class,
which provides the Settings property for saving and retrieving settings.


Pages:
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221