Below is my codes. Currently the codes gets data from gps devices. The problem now if you notice is that I have to send twice the acknowledgement message that is w.write("$PA\n"); w.flush(); once in line 56 and 57 and once more in 85 and 86 then only I will receive all the 5 strings. Currently my method of receving is the one I have commented out that is from 62 to 128. I notice that if I dont know send the second acknowledgement I only receive the single string but it suppose to be 5 strings. So I am trying to revert to readline method at line 58 but unfortunately it always wait for \n rather than null. Any help.