Reading serial Port using select api
I am reading data using two no of serial ports. My data is nothing but count down time generated by a clock generator. After Every one second the new data arrives.
The code works fine but when i remove input from one serial port and again put it back then it should get the time which is comming.But both serial port are not reading data simultaneously but the are reading in alternate ie if one serial port reads 01:05:11 the other reads 00:00:00 and vice versa. I want that both ports should read simultaneously.
another problem is that when i am removing one serial port the removal of serial port from fd_set is not reflecting immediately but after 20-30 seconds. e.g if two fds are there and i remove one input the only one fd should be there but it shows two fds for some time and after 20-30 second it show only one fd
Please tell where is problem in the code.
Your interesting indentation style makes your code virtually unreadable. I suggest that you acquaint yourself with the indent command.
I do note a few things:
You seem to test the input buffer for an integer value '1' in the first element, and then print the array in string context. That part seems very strange to me. It is
Here i am printing the serila data at every one sec interval. Because every new data is havinh SOH(Start of herader) whose integer value is 1. Thats why to reducing the printing frequency i am checking SOH
|All times are GMT -5. The time now is 06:03 PM.|