PDA

View Full Version : RS232 communication



sattu
23rd September 2010, 09:48
hi everyone!
We are doing serial communication between a linux and windows P.C using rs232. The server programm is written in Qt while the client programme is in VB.net. In the server we have 1lakh records in the database. And we need to display all the 1lakh records in client side. While sending, we are not having any problem. But in the client side, the buffer that is meant to receive the data is able to store only upto 4k of data. After that data is lost. So can any one tell me, what to do in this case? Whether we have to modify the server programme or else is there any method to increase client side buffer size or some thing like that?
thanks in advance,

with regards,

dpatel
23rd September 2010, 11:18
I don't know much about RS232 protocol, but at the very least you can send certain amount of data(4K) and wait until you get feedback from client that the data is consumed and then send another data.
If this slows down the application, you can write a thread which takes the data from buffer on client side and puts into a bigger buffer so that server can keep on sending data.

sattu
23rd September 2010, 11:38
I don't know much about RS232 protocol, but at the very least you can send certain amount of data(4K) and wait until you get feedback from client that the data is consumed and then send another data.If..........................
Well, we are thinking of doing these, but here 4k means we are only able to send maximum of 260 records(with fields id,name,address). That seems a vary small amount when compared to 1lakh records which we actually have to sent, so isn't there any option of increasing the buffer size or reading the data before the buffer is full? can you help regarding these?:confused:

Lesiok
24th September 2010, 07:44
This 4k buffer is in RS232 driver as I think. You must have in Yours application a buffer for all data. Or create more intelligent protocol ie. read data from server partially depend on necessity. And of course You must use some method of RS232 synchronisation to not overwrite data in receiver.

ChrisW67
24th September 2010, 08:03
This seems like a .Net question rather than a Qt question. There must be some method of allocating a buffer in .Net that can grow to accept data you read in small chunks as it becomes available at the serial port. Given your 260 records per 4096 bytes, the 100000 records you are talking about will need a 1.5 MB buffer to hold everything.

You should consider building a more formal data structure on-the-fly as you receive complete records into a small ring buffer (http://en.wikipedia.org/wiki/Ring_buffer) (say about three times the largest record size).