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...

Thanks in advance!

Reply to
Wouter Eckhardt
Loading thread data ...

Wouter Eckhardt wrote: : 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!

Reply to
J Jackson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.