Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Receiving data through serial port in Java

Status
Not open for further replies.

Sputnik

Full Member level 3
Full Member level 3
Joined
Oct 19, 2004
Messages
150
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
South Africa
Activity points
1,667
I have written a program that can send data out the serial port. But now I want to receive on the same computer. I have made a loopback serial connection. When I try to use whatever.readLine() I don't get any compilation errors, but the program hangs on that line (ie. not freezes, but doesn't continue). The only successful method I've found to use is to use whatever.read() which reads a byte at a time which is being incredibley slow (for a Pentium I).

I initialise the reader in the following way:
Code:
DataInputStream is = new DataInputStream(port.getInputStream());
BufferedReader input = new BufferedReader (new InputStreamReader(is));
...
Does anyone have a better method for reading from the serial port?

If anything is unclear, just ask.

Sputnik :idea:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top