[comp.windows.x] XtAppAddInput Behaviour

trey@mcnc.org (Joseph R. Bishop) (05/31/89)

I am writing an application using the X Version 11, Release 3 Toolkit
Intrinsics and Athena Widgets. Within the application I make a call to
XtAppAddInput passing a socket descriptor as the "source" argument and
XtInputReadMask as the "condition" argument. My goal is to call the
procedure passed as the "proc" argument each time data is ready to be
read from the socket, i.e. each time data is written to its connected
peer socket. The procedure itsself reads any data ready to be read from
the socket.

I ran a small test program where I wrote a single approximately 20
character long string to the peer socket. I expected the procedure
to be called once and the character string read. Upon running the
the test program, the character string was successfully read.
However, instead of proceeding on with the rest of the test program,
an infinite loop was entered with the "proc" procedure being called
over and over.

Any advice? Thanks in advance.

Trey Bishop
Duke University
Department of Electrical Engineering
trey@dukee.egr.duke.edu

pusateri@romeo.cs.duke.edu (Thomas J. Pusateri) (05/31/89)

In article <1228@speedy.mcnc.org>, trey@mcnc.org (Joseph R. Bishop) writes:
> I ran a small test program where I wrote a single approximately 20
> character long string to the peer socket. I expected the procedure
> to be called once and the character string read. Upon running the
> the test program, the character string was successfully read.
> However, instead of proceeding on with the rest of the test program,
> an infinite loop was entered with the "proc" procedure being called
> over and over.


	I experienced a similar problem and realized that I had closed the
end of the socket that was writing before I exited the Xt main loop. When
you do this, you get an infinite loop because its waiting for an EOF.
Try keeping the socket open until you exit your X program. If you want
an example or a demonstration, feel free to stop by or send mail or call.

Tom Pusateri
Duke Medical Center
Nanoline Duke Bldg.
Room 384A
681-3048

pusateri@nbsr.mc.duke.edu

swick@ATHENA.MIT.EDU (Ralph R Swick) (05/31/89)

> Upon running the
> the test program, the character string was successfully read.
> However, instead of proceeding on with the rest of the test program,
> an infinite loop was entered with the "proc" procedure being called
> over and over.

Please make sure you have the published fixes installed, at least
through fix8.  Then, if your problem still occurs, submit a bug
report with a demonstration program to reproduce the error to xbugs.