From: davidvc@cosmo.sybase.com (David Van Couvering)
Newsgroups: comp.databases.sybase
Subject: Re: Open Server problem
Date: 8 Jan 93 17:54:11 GMT

In article <1993Jan6.101709@is.morgan.com>, shafla@is.morgan.com (Sharon Flanagan) writes:
|> 

|> 
|> I'm working with a Sybase open server based on the "utility" sample program.
|> I've written an RPC which allowes various clients to send and recieve
|> information.  When a client registers for information, it sends the name of
|> the RPC, a paramater that indicates it is a register message, its transaction
|> type, and some parameters to hold the information it wants.  

Sound good so far

|> The function
|> allocates space for a new srvproc, uses srv_bmove() to copy the srvproc and
|> this new srvproc is then added to a linked list which is indexed by
|> transaction type.  When a client notifies the open server that it has
|> information, it sends the name of the RPC, a parameter that indicates that
|> it is a notify message, its transaction type, and parameters which hold its
|> information. The code goes through the linked list - if it finds a matching
|> transaction type, it puts information from the current srvproc to a copy of the srvproc from the linked list.

It seems a little dangerous going about copying srvprocs and then trying
to use them in Open Server calls.  If you are going to set up a linked
list of srvprocs, why not just use the pointers rather than copying the
entire structure?  

|> 
|> PROBLEM:
|> The forementioned program works with the first notify.  I use the
|> srv_senddone() with the SRV_DONE_FINAL flag set when I return the information
|> to the registering client.  However, when another client notifies that it
|> has information, my program gets a SEGV error when it tries to find the number
|> of parameters in the linked list srvproc.  The srv_senddone() function
|> seems to clear out the parameters from the srvproc in the linked list -
|> I've used a srv_rpcparams() call after the srv_senddone() and its result is
|> -1 (perhaps no current RPC).  I've used srv_bmove to copy the srvproc from
|> the linked list into another area of memory - but it didn't help.
|> 
|> How can I send information back to the clients multiple times over the open
|> server - client connection?  Is there a way to circumvent the "flush" which
|> happens with a srv_senddone?  If I use the SRV_DONE_MORE flag, the client
|> doesn't get data.
|> I've tested the open server using functions which login to it and then
|> send information via the dbproc (dprpcparam(), dbrpcsend()).
|> 

It's hard to get clear what's going on here, as is usually the case
when you're trying to describe an application in 100 words or less...

You might want to look into using notifications to notify clients, 
rather than sending rows to notify them.  Clients can register interest
in particular Open Server RPCs, and then they will get notified whenever 
that RPC is invoked in the Open Server.  Take a look at the 4.6/2.0
docs for more information...

|> Any ideas?????
|> 
|>  
|> Thanks in advance for any assistance.
|> 
|> Sharon Flanagan
|> shafla@is.morgan.com

Hope this helps,

David
-- 
davidvc@sybase.com | {pacbell,lll-tis,pyramid,sun}!sybase!davidvc
David Van Couvering Sybase 1650 65th Street Emeryville, CA  94608
- Opinions expressed here are mine and not necessarily those of Sybase -