Hi everyone,

I'm writing an Xlib-based emulator.  I've got much of the X part done and
now I need to hook it up to lib5250.  In order to check for X events and
5250 data I need a file descriptor that represents the 5250 stream so I
can use select().  Looking through the tn5250 source it looks like the
tn5250_stream_socket_handle() function will give me the file descriptor I
need.  I want to do something like this:

#define max(x,y) ((x) > (y) ? (x) : (y))

int maxfd = 0;
lib5250fd = tn5250_stream_socket_handle (stream);
xconnectionfd = XConnectionNumber (display);
maxfd = max (maxfd, lib5250fd);
maxfd = max (maxfd, xconnectionfd);
FD_ZERO (&filedescs);
FD_SET (lib5250fd, &filedescs);
FD_SET (xconnectionfd, &filedescs);
select (maxfd + 1, &filedescs, NULL, NULL, NULL);

And then act on the result of select().  In the case of
(FD_ISSET (lib5250fd, &filedescs)) == TRUE
what function(s) do I call to retrieve the 5250 data?

Also, what is the order of the functions that I need to call in order to
set up the stream?  I think I have it right (from looking at tn5250.c) but
I want to be sure.  It looks like I need to do:

config = tn5250_config_new ();
stream = tn5250_stream_open (tn5250_config_get (config, "host"), config);

At this point I should be ready to read the stream, right?  Possibly with
a read(stream, buf, count); ?

James Rich

Vs lbh guvax bs argjbex frphevgl nf na vzzhar flfgrz, Jvaqbjf vf UVI.
        -- Wbr Cyhgn

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.