" /> Another t-lib Question - Genesys CTI User Forum

Author Topic: Another t-lib Question  (Read 5054 times)

Offline Genecist

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • Screen Pop Software
Another t-lib Question
« on: December 07, 2006, 04:43:17 AM »
Advertisement
What's the best way to listen to 2 or more tserver connections for events using the t-lib sdk?

When only one TServer is in play, I spawn TScanServerEx in a thread.  But because t-lib is not thread safe, spawning TScanServerEx in a separate thread for each TServer connection is neither supported and does result in crashing.

The Genesys knowledge base recommends using conn_main_loop instead of TScanServerEx when more than one TServer is being listened too.

I've tried conn_main_loop with some success.  But I have some stability issues that preclude certifying for production use.

Thanks for any help.


Koki

  • Guest
Re: Another t-lib Question
« Reply #1 on: December 07, 2006, 10:37:32 AM »
[quote author=Genecist link=topic=1940.msg6468#msg6468 date=1165466597]
What's the best way to listen to 2 or more tserver connections for events using the t-lib sdk?

When only one TServer is in play, I spawn TScanServerEx in a thread.  But because t-lib is not thread safe, spawning TScanServerEx in a separate thread for each TServer connection is neither supported and does result in crashing.

The Genesys knowledge base recommends using conn_main_loop instead of TScanServerEx when more than one TServer is being listened too.

I've tried conn_main_loop with some success.  But I have some stability issues that preclude certifying for production use.

Thanks for any help.


[/quote]

I am sorry if it is a very stupid question, but what is wrong with just using two TConnections?

Koki

Offline Genecist

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • Screen Pop Software
Re: Another t-lib Question
« Reply #2 on: December 07, 2006, 02:48:06 PM »
I can open 2 sockets using 2 different calls to TOpenServerEx no problem.

But now, how to monitor those 2 connections for events?  With one connection, a simple loop with calls to TScanServerEx using the handle from one TOpenServerEX can be spawned in a thread. 

But since T-lib isn't thread safe, you can't spawn multiple threads for each open connection.

This is verified by Genesys themselves.  For processing of multiple TServer connections, they recommend, instead of using TScanServerEx, to use conn_main_loop...which is a very poorly documented and only trivial examples are available in the knowledge base.

Offline Haldane

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 1
Re: Another t-lib Question
« Reply #3 on: December 07, 2006, 02:58:43 PM »
Genesist,
    If memory serves me right I recall Genesys stating that conn_main_loop is not offically supported..... Is there anyway you can create your own fuction TopenServerEX..... i.e improve on the one supplied in the TLib

Offline Genecist

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • Screen Pop Software
Re: Another t-lib Question
« Reply #4 on: December 07, 2006, 05:58:40 PM »
Oh great, not supported, huh?  Well that throws a spanner into everything.

Well then, I'll have to wrap each tserver connection and corresponding dispatch function in it's own address space and communicate to the main client app across process boundaries.

A lot more work than I thought I was getting into.

Thanks for the help.

BTW, seems to me a lot of you guys use the activeX wrapper...does it allow multiple tserver connections within the same application?

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1419
  • Karma: 18
Re: Another t-lib Question
« Reply #5 on: December 11, 2006, 01:52:37 AM »
[quote author=Genecist link=topic=1940.msg6484#msg6484 date=1165514320]
Oh great, not supported, huh?  Well that throws a spanner into everything.

Well then, I'll have to wrap each tserver connection and corresponding dispatch function in it's own address space and communicate to the main client app across process boundaries.

A lot more work than I thought I was getting into.

Thanks for the help.

BTW, seems to me a lot of you guys use the activeX wrapper...does it allow multiple tserver connections within the same application?
[/quote]

Genecist,

yes, I pretty much gave up on Tlib and now only puruse ActiveX based development, because it is easy.
Using multiple TConnection objects do not really cause any problems. There are issues with compatibility between different Genesys ActiveX (like program compiled using 7.0 would not work with 7.1) but I am sure we are not doing something right.

Of course, if you are developing with linux or Unix, then I guess you do not have a lot of choice on what you can use.

BTW, I am curious, is it necessary to use Genesys ActiveX? Can we develop our own without using either? I can think of several modifications to the existing ActiveX component and protocol that would improve all of our lives.

Of course, this would require some reverse engineering, and my gut feeling is that Genesys would frown upon it. Has anyone actually tried it?

ufo

  • Guest
Re: Another t-lib Question
« Reply #6 on: December 15, 2006, 10:53:22 AM »
Hi,
You can have only one DispatchFunction in a process.

I used the Server Field of event to match the server
e->Server is a file descriptor the same that you recieve from TopenServer...

and I used a conn_main_loop(); into a separate thread

I hope this help You.
Paolo