Click here to Skip to main content
15,913,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 3:14
N a v a n e e t h18-Jul-08 3:14 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
matthias s.18-Jul-08 3:52
matthias s.18-Jul-08 3:52 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 17:17
N a v a n e e t h18-Jul-08 17:17 
QuestionUsing MIRR function in c# Pin
sumit703418-Jul-08 0:16
sumit703418-Jul-08 0:16 
AnswerRe: Using MIRR function in c# Pin
CPallini18-Jul-08 0:32
mveCPallini18-Jul-08 0:32 
GeneralRe: Using MIRR function in c# Pin
sumit703418-Jul-08 0:38
sumit703418-Jul-08 0:38 
GeneralYou are welcome. Pin
CPallini18-Jul-08 0:41
mveCPallini18-Jul-08 0:41 
QuestionSerialPort and data received event Pin
kildareflare18-Jul-08 0:02
kildareflare18-Jul-08 0:02 
Hello All

I am writing an application to monitor the serial port (RS232) and extract appropriate data from a continual ASCII stream that is written to it by a connected device.

The problem I have is with the datareceived event.

I want to work on the data received a byte at a time.

Thus I have set the datreceived threshold to a byte.

I would thus expect a new event to be generated each time a new byte is recieved.

I currently have a test app mimicking the connected device and I can send test strings to the monitoring application.

If I send strings of 2 bytes or less, 2 events are raised and I can process each individually.

However if I send longer strings, only 2 events are raised. The remaining unprocessed bytes remain in the buffer and are processed when a new event is raised.

I can use serialPort1.BytesToRead to determine number of bytes in the buffer and process them in a while loop. However this is not how I want this to work. I need to handle each byte as it is recieved.

Am i doing something silly?

Thanks

        public Form1()
        {
          serialPort1.DataReceived +=new    SerialDataReceivedEventHandler(serialPort1_DataReceived);
           serialPort1.ReceivedBytesThreshold = 1;

        private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
                byte[] buffer = new byte[1];

                try
                {
                    serialPort1.Read(buffer, 0, 1);
                }
}

AnswerRe: SerialPort and data received event Pin
kildareflare18-Jul-08 1:01
kildareflare18-Jul-08 1:01 
GeneralRe: SerialPort and data received event Pin
Luc Pattyn18-Jul-08 1:38
sitebuilderLuc Pattyn18-Jul-08 1:38 
QuestionCan any body Tell me about 64 bit Pin
wasimsharp17-Jul-08 23:46
wasimsharp17-Jul-08 23:46 
AnswerRe: Can any body Tell me about 64 bit Pin
windhopper17-Jul-08 23:54
windhopper17-Jul-08 23:54 
GeneralRe: Can any body Tell me about 64 bit Pin
wasimsharp18-Jul-08 0:10
wasimsharp18-Jul-08 0:10 
QuestionConsume a webservice in a WebApplicationnew Pin
AS@1317-Jul-08 23:37
AS@1317-Jul-08 23:37 
AnswerRe: Consume a webservice in a WebApplicationnew Pin
N a v a n e e t h17-Jul-08 23:43
N a v a n e e t h17-Jul-08 23:43 
QuestionRe: Consume a webservice in a WebApplicationnew Pin
AS@1317-Jul-08 23:52
AS@1317-Jul-08 23:52 
AnswerRe: Consume a webservice in a WebApplicationnew Pin
enginço18-Jul-08 0:03
enginço18-Jul-08 0:03 
QuestionRe: Consume a webservice in a WebApplicationnew Pin
AS@1318-Jul-08 0:11
AS@1318-Jul-08 0:11 
AnswerRe: Consume a webservice in a WebApplicationnew Pin
enginço18-Jul-08 0:35
enginço18-Jul-08 0:35 
QuestionRe: Consume a webservice in a WebApplicationnew Pin
AS@1318-Jul-08 0:56
AS@1318-Jul-08 0:56 
QuestionUse NGEN with WebDeployment Pin
Merlin Tintin17-Jul-08 23:06
Merlin Tintin17-Jul-08 23:06 
AnswerRe: Use NGEN with WebDeployment Pin
Scott Dorman18-Jul-08 1:09
professionalScott Dorman18-Jul-08 1:09 
AnswerRe: Use NGEN with WebDeployment Pin
Simon P Stevens18-Jul-08 2:00
Simon P Stevens18-Jul-08 2:00 
GeneralRe: Use NGEN with WebDeployment Pin
Merlin Tintin18-Jul-08 4:17
Merlin Tintin18-Jul-08 4:17 
GeneralRe: Use NGEN with WebDeployment Pin
Daniel Grunwald18-Jul-08 6:06
Daniel Grunwald18-Jul-08 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.