PPP communication problem on uclinux

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

I'm quite new at programming in linux (and uclinux), so if I'm asking
for obvious answers here, please excuse me.

Here's the situation:
I'm programming an application for the Intermec CK1 handheld computer,
which runs uclinux. Using some functions provided by the hardware
manufacturer, I create a serial PPP connection to my host PC and start
communicating with the host using streams which I created from my
socket discriptor. I send and receive data using the function fputc()
and fgetc().

My problem is, when the serial connection is lost for some reason
(cable disconnected, for example) during communication, my calls to
fputc() or fgetc() hang, locking my app. I read in the documentation
of glibc (which I was given by the manufacturer, they claim it's
basically the same as uclibc) that these functions should return EOf
when this happens. Obviously, they don't.

My question is, is this because of uclibc? Or should the OS image for
the handheld computer handle this?

I'm at a loss to solve this. I know threading may solve my problem,
but as I'm just a beginner, I'd like to keep things a bit simple...

Thanks in advance!

Re: PPP communication problem on uclinux
: Hi,

: I'm quite new at programming in linux (and uclinux), so if I'm asking
: for obvious answers here, please excuse me.

: Here's the situation:
: I'm programming an application for the Intermec CK1 handheld computer,
: which runs uclinux. Using some functions provided by the hardware
: manufacturer, I create a serial PPP connection to my host PC and start
: communicating with the host using streams which I created from my
: socket discriptor. I send and receive data using the function fputc()
: and fgetc().

: My problem is, when the serial connection is lost for some reason
: (cable disconnected, for example) during communication, my calls to
: fputc() or fgetc() hang, locking my app. I read in the documentation
: of glibc (which I was given by the manufacturer, they claim it's
: basically the same as uclibc) that these functions should return EOf
: when this happens. Obviously, they don't.

: My question is, is this because of uclibc? Or should the OS image for
: the handheld computer handle this?

: I'm at a loss to solve this. I know threading may solve my problem,
: but as I'm just a beginner, I'd like to keep things a bit simple...

You need to to do nonblocking reads/writes.

Check the      

O_NONBLOCK or O_NDELAY
option to the open syscall

You may need to use select to see when there is data to read etc

do a google search for "linux non-blocking io" or similar.


: Thanks in advance!

Site Timeline