Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Whats the Difference between Readline and readexisting

Posted on 2011-09-02
3
Medium Priority
?
2,414 Views
Last Modified: 2012-08-13
I have setup a com port read property and trying to send a signal from my external device to my PC. When I use the com port readline I cannot see anything over the com port, however when I use the readexisting I can see the data over the com port. Whats the difference?
0
Comment
Question by:cmdolcet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 252 total points
ID: 36476850
ReadExisting gets any data that is lying in the receive buffer.

ReadLine waits until it detects an end of line value in the data. If data has been received but there was no end of line code in the data, Readline returns nothing. This makes it easier to read text line by line, because the system takes care of identifying the end of each line.

If the type of data you receive is not made of  text, ReadLine is useless. It might never trigger, because the com port might never receive end of line values. And if it does (usually values 13 and/or 10), they won't really represent and and of line, they are probably only those values in binary data.
0
 

Author Comment

by:cmdolcet
ID: 36477889
I know my data end of line is a CR would this be the same?
0
 
LVL 64

Assisted Solution

by:Fernando Soto
Fernando Soto earned 248 total points
ID: 36477947
Hi cmdolcet;

The SerialPort.ReadLine Method expects to see a NewLine to mark the end of the string. The new line is a sequence of two characters, \r\n, which represents a Cr and Lf NOT just a CR and is the reason why you are not seeing any response on the line.

Fernando
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question