Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-31-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Question ICE calling a Single Threaded DLL

Hello.

Im trying to build an application with ICE that would only use a single instance of an Application. What I mean is that it should be able to accept connection from multiple clients but all the processes are going to be managed by one application. Hmmm. Lets put it this way.

1. Server starts, setup ICE initializations stuff, then creates a new instance of a VB DLL.
2. Client 1 connects and sends a string expecting a return parameter.
3. Server recieves the string and sends it to the VB DLL instance.
4. VB DLL returns a value and returns it to ICE server.
5. Ice Server returns the value to Client 1.
6. Client 2 connects and sends a string to the Ice Server.
7. Ice server recieves the string AND DOES NOT create a new instance of the VB DLL ... it will keep on using the current one.
8. VB DLL recieves the string ... but works on it for some time.
9. Client 1 sends another string to the Ice server.
10. ICe Server recieves Client 1's string but waits till the VB DLL is finished with Client 2's command.
11. VB DLL is finishes with the Client 2's command and returns a value.
12. Ice Send the string back to client 2.
13. Ice now sends the string to VB DLL.
14. Client 2 recieves the value and is Happy.
15. VB Dll Receives the string ,work on it and return result.
16. Ice Server returns result to Client 1.
17. Client one recieves result and is Happy.

I have made a slice definition for this and I'm already working on the client and server codes for the VB DLL interaction.

Quote:
interface jSockets
{
string jclCommand(string command);
};
I fear that, since I don't understand ICE full yet (I just read the docs), I might be missing some crucial stuff. So anybody has suggestions or reminders related with this endeavor?

Thanks.

Alex
Attached Thumbnails
ice-calling-single-threaded-dll-icelayout.jpg  
Reply With Quote
  #2 (permalink)  
Old 08-01-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Ice does not create any DLLs. So it's up to your code to load one or several DLLs.

If you want to avoid that your code is called by multiple threads, you have two possibilities:[list=1][*]You can simply set the server side thread pool size to one. Then only one thread will call operations on Ice objects.[*]You can add mutex protection to your operations, so that only one thread can enter them.[/list=1]
Reply With Quote
  #3 (permalink)  
Old 08-01-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Hello Marc,

The server will be calling either an EXE or a DLL through OLE automation. I'm actually having some trouble with converting char* to ::std::string right now.

Considering my C++ skills, I think that the first one is the best option for me.

So, how do I set the server side pool to 1?

Thanks.

Alex
Reply With Quote
  #4 (permalink)  
Old 08-01-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
That's described in the manual. Just set the property Ice.ThreadPool.Server.Size to 1.
Reply With Quote
  #5 (permalink)  
Old 08-01-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Thats great since its only as simple as setting a property.

Thanks. I'll try it ASAP.

Alex
Reply With Quote
  #6 (permalink)  
Old 08-04-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
I'm a bit embarrased to ask but I couldn't make this work.

First off, the documentation states that:
Quote:
Ice.Config

Synopsis
--Ice.Config --Ice.Config=1 --Ice.Config=config_file

Description
This property must be set from the command line with the --Ice.Config, --
Ice.Config=1, or --Ice.Config=config_file option.
If the Ice.Config property is empty or set to 1, the Ice run time examines the contents of the ICE_CONFIG environment variable to retrieve the pathname of a configuration file. Otherwise, Ice.Config must be set to the pathname of a configuration file. (Pathnames can be relative or absolute.) Further property values are read from the configuration file thus specified.
So I created a file called jSockets.cfg and put in the following entry:
Quote:
// Make sure that were using only a single server thread
Ice.ThreadPool.Server.Size = 1
I initially thought that all I have to do is update the slice2cpp script to include the option as described above. It didn't work. I tried again by updating the C++ command line parameters ... didn't work too.

So how do I do this?

Thanks.

Alex
Reply With Quote
  #7 (permalink)  
Old 08-04-2003
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Hi Alex,

Yes, we need to add more details on the configuration in the documentation!

The --Ice parameters must be passed to the Ice::initialize() function, for example:

int main(int argc, char* argv[])
{
Ice::CommunicatorPtr communicator = Ice::initialize(argc, argv);
//...
}

If you want to use the config file jSockets.cfg, you would use:
program --Ice.Config=jSockets.cfg

If you initialize the communicator in a DLL, you may not be able to get the argc/argv from the main program; you can then either manufacture the argc/argv or (easier) use initializeWithProperties().

Also note that properties such as the thread pool size affect the runtime behavior: pass them to your program, not slice2cpp!

Best regards,
Bernard
Reply With Quote
  #8 (permalink)  
Old 08-04-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Hello Bernard,

Thanks. I haven't thought of that.

Alex
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
plz help:error in c++ when calling a webservice erco Help Center 1 03-16-2006 03:30 AM
Is the IceGrid registry a single point of failure? timp Help Center 1 01-16-2006 07:05 AM
Only multi-threaded DLL libraries can be used with Ice! chenhong_sz Bug Reports 4 04-20-2005 05:23 AM
Ice and single threaded libraries Nis Baggesen Help Center 4 03-22-2005 05:25 AM
single stream for two-way communication? vukicevic Help Center 2 05-19-2003 04:17 PM


All times are GMT -4. The time now is 11:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.