termios setup in linux

sherry
Dear all,

  I am trying to write program to write and read data from uart or serial
port but I am stuck with 2 Isuues like 
1) in Cannonical mode it need  hit enter key (carriage return) to read
data...
2) In raw mode data can be read within fixed interval or less 255
characters ...

so my question that I want to receive any time data with respect to timeout
or and special character(like carriage return)


if any one have faced this issue and solved let me know