List Info

Thread: Does async work?




Does async work?
country flaguser name
United States
2007-02-09 17:47:42
Hi,

I'm having lots of problem with async connections.

First, I try to establish a synchronous connection this
way:

   opt = ZOOM_options_create
   ZOOM_options_set (opt, "databaseName",
wDatabaseName)
   ZOOM_options_set (opt, "preferredRecordSyntax",
recordSyntax)

   tZoomConnection = ZOOM_connection_create(opt)

   ZOOM_connection_connect( tZoomConnection, serverAddress,
serverPort )

it works and I can search If I add one line:

   ZOOM_options_set (opt, "async", "1")

tZoomConnection is given a valid number, but the search
always returns no hits.

This is the search:

   tZoomResultSet = ZOOM_connection_search_pqf(
tZoomConnection, 
finalSearchString )

Oddly, if I add the following line *after* the search I get
hits again:

   zRecord = 	ZOOM_resultset_record( tZoomResultSet, 0 )



Second, when I go through all of that to get an asynchronous
search 
--- it's not asynchronous! The UI locks up whenever I make a
call to 
the YAZ library and comes back to life when the call is
completed. 
That is, the search works, but is synchronous.

Can anyone tell me what I'm doing wrong?

Thanks,

Jon

_______________________________________________
Yazlist mailing list
Yazlistlists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list

Does async work?
user name
2007-02-12 07:55:02
jda writes:
 > Hi,
 > 
 > I'm having lots of problem with async connections.
 > 
 > First, I try to establish a synchronous connection
this way:
 > 
 >    opt = ZOOM_options_create
 >    ZOOM_options_set (opt, "databaseName",
wDatabaseName)
 >    ZOOM_options_set (opt,
"preferredRecordSyntax", recordSyntax)
 > 
 >    tZoomConnection = ZOOM_connection_create(opt)
 > 
 >    ZOOM_connection_connect( tZoomConnection,
serverAddress, serverPort )
 > 
 > it works and I can search If I add one line:
 > 
 >    ZOOM_options_set (opt, "async",
"1")
 > 
 > tZoomConnection is given a valid number, but the
search always returns no hits.
 > 
 > This is the search:
 > 
 >    tZoomResultSet = ZOOM_connection_search_pqf(
tZoomConnection, 
 > finalSearchString )
 > 
 > Oddly, if I add the following line *after* the search
I get hits again:
 > 
 >    zRecord = 	ZOOM_resultset_record( tZoomResultSet, 0
)
 > 
 > 
 > 
 > Second, when I go through all of that to get an
asynchronous search 
 > --- it's not asynchronous! The UI locks up whenever I
make a call to 
 > the YAZ library and comes back to life when the call
is completed. 
 > That is, the search works, but is synchronous.
 > 
 > Can anyone tell me what I'm doing wrong?

Yes, async does work, but it's hard to do right.  Party
that's because
asynchronous programming is Just Plain Hard, and partly it's
because
the documentation at
	http://i
ndexdata.com/yaz/doc/zoom.events.tkl
is decided on the terse side.

We'd love to write a proper tutorial for that, but as is so
often the
case, commercial concerns intervene, and just can't find the
time to
write all the free documentation we'd like to.  For now, the
best way
to learn to use YAZ asyncronously is from the source code of
the
various ZOOM test programs in the YAZ distribution:
zoomtst2.c,
zoomtst3.c, etc.

Good luck!

 _/|_	
____________________________________________________________
_______
/o ) /  Mike Taylor    <mikeindexdata.com>    http://www.miketaylor.or
g.uk
)_v__/  "What is this talk of 'release'?  Klingons do
not make software
	 'releases'.  Our software 'escapes,' leaving a bloody
trail of
	 designers and quality assurance people in its wake."
-- Klingon
	 Programming Mantra


_______________________________________________
Yazlist mailing list
Yazlistlists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list

Re: Does async work?
country flaguser name
Denmark
2007-02-12 09:44:22
jda wrote:
> Hi,
> 
> I'm having lots of problem with async connections.
> 
> First, I try to establish a synchronous connection this
way:
> 
>   opt = ZOOM_options_create
>   ZOOM_options_set (opt, "databaseName",
wDatabaseName)
>   ZOOM_options_set (opt,
"preferredRecordSyntax", recordSyntax)
> 
>   tZoomConnection = ZOOM_connection_create(opt)
> 
>   ZOOM_connection_connect( tZoomConnection,
serverAddress, serverPort )
> 
> it works and I can search If I add one line:
> 
>   ZOOM_options_set (opt, "async",
"1")

For the async mode operation you are supposed to call
function 
ZOOM_event (*). The async name is probably a bad name.. It
just means 
that operations are postponed until ZOOM_event is called.

Refer to example programs zoomtst2.c, zoomtst3.c .

*: there is also an alternative set of functions for
ZOOM_event which 
may be used if you using an API with its own socket select
wrapper - see 
zoom.h .

/ Adam

> tZoomConnection is given a valid number, but the search
always returns 
> no hits.
> 
> This is the search:
> 
>   tZoomResultSet = ZOOM_connection_search_pqf(
tZoomConnection, 
> finalSearchString )
> 
> Oddly, if I add the following line *after* the search I
get hits again:
> 
>   zRecord =     ZOOM_resultset_record( tZoomResultSet,
0 )
> 
> 
> 
> Second, when I go through all of that to get an
asynchronous search --- 
> it's not asynchronous! The UI locks up whenever I make
a call to the YAZ 
> library and comes back to life when the call is
completed. That is, the 
> search works, but is synchronous.
> 
> Can anyone tell me what I'm doing wrong?
> 
> Thanks,
> 
> Jon
> 
> _______________________________________________
> Yazlist mailing list
> Yazlistlists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list
> 
> 


_______________________________________________
Yazlist mailing list
Yazlistlists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )