G
Guest
Hi,
I developed two applications to test a flush() method in my application, but I am having some problems when running it at high baud rates (115200)
I connected two computers using a cross-talk cable and wanted to test if all data sent from application 1 was correctly received by application 2 (test the flush method).
The first application is the receiver - basically it opens the serial port and loops infinitely. Inside the loop, it reads from the port and sleeps for 1 seconds (simulating a very slow connection). It also counts the number of bytes received so that I can compare if all data sent was received
The second application is the transmitter - It opens the serial port for a SYNCHRONOUS connection, and uses the WriteFile method to write a certain small buffer (26 bytes) N times. It consists of several loops, where right after writing the data it calls my flush() method which checks if the TX buffer is empty (checks if all data sent were received).
If TX buffer has any bytes on it, them the application sleeps for some while, waiting till all data is transmitted. Otherwise, it goes to the next iteration of the loop, to write more data
The program runs fine if I do not open the serial port at 115200. When running it at this specific bit rate, most of the data sent is lost (the transmitter sends everything, but not all data is received by the received application)
The TX buffer is always empty, which - according to MS documentation - is correct because I am using a synchronous connection. However, I don't understand how couldn't the data be sent! Why am I loosing data? Shouldn't it be supposed to be synchronized?? It there anything else I should do after writing the data (after calling WriteFile) to guarantee that the data was received
Both machines are running Windows 2000
Software was developed using Visual C++ 6.0 - pure win32 application (no .NET use - yet)
Any help would be greatly appreciated
Regard
Pete
I developed two applications to test a flush() method in my application, but I am having some problems when running it at high baud rates (115200)
I connected two computers using a cross-talk cable and wanted to test if all data sent from application 1 was correctly received by application 2 (test the flush method).
The first application is the receiver - basically it opens the serial port and loops infinitely. Inside the loop, it reads from the port and sleeps for 1 seconds (simulating a very slow connection). It also counts the number of bytes received so that I can compare if all data sent was received
The second application is the transmitter - It opens the serial port for a SYNCHRONOUS connection, and uses the WriteFile method to write a certain small buffer (26 bytes) N times. It consists of several loops, where right after writing the data it calls my flush() method which checks if the TX buffer is empty (checks if all data sent were received).
If TX buffer has any bytes on it, them the application sleeps for some while, waiting till all data is transmitted. Otherwise, it goes to the next iteration of the loop, to write more data
The program runs fine if I do not open the serial port at 115200. When running it at this specific bit rate, most of the data sent is lost (the transmitter sends everything, but not all data is received by the received application)
The TX buffer is always empty, which - according to MS documentation - is correct because I am using a synchronous connection. However, I don't understand how couldn't the data be sent! Why am I loosing data? Shouldn't it be supposed to be synchronized?? It there anything else I should do after writing the data (after calling WriteFile) to guarantee that the data was received
Both machines are running Windows 2000
Software was developed using Visual C++ 6.0 - pure win32 application (no .NET use - yet)
Any help would be greatly appreciated
Regard
Pete