Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-05-2006
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
-->
Ice::Service Class in C#?

Just got some free-time again to work on my pet project and I recoded the my network library (which uses Ice) from C++ to C#.

I tell you guys, I really appreciate the support for C#, its really way easier than C++. I was able to recode using a the normal console application which just use the waitForShutdown() function call.

So, I kept thinking that converting it into a service would be a snap since it was really easy with C++ when you just use the Ice::Service singleton class.

Well, to make my rather winded story short, theres no way I could create a an Ice::Service class.

Am I correct in assuming that IceCS.dll does not support the Ice::Service class? Is there a way around this? I would appreciate any suggestions or help.

Thanks.
__________________
Alex Rufon
jDatabase Development Team
jDatabase - a native database for the J programming language
Reply With Quote
  #2 (permalink)  
Old 09-05-2006
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 976
Hi Alex,

You're correct, we don't have a C# version of Ice::Service yet, but it's something we intend to add eventually. Meanwhile, you could start by deriving your own class from System.ServiceProcess.ServiceBase, as described here.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 09-05-2006
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Hi Alex,

why don't you simply use iceboxnet? This eventually simplifies your implementation as you don't have to care about the bootstrapping etc. Simply implement your classes and 'go'.

regs,

Stephan
__________________
Stephan Stapel
Software Architect
Author of 'Verteilte Internet-Anwendungen mit Ice', ix 07/2005
Author of 'Webbasierte Anwendungen mit IcePHP', ix, 06/2006
Reply With Quote
  #4 (permalink)  
Old 09-06-2006
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
-->
@mes

Yap, I did create a class using the .NET ServiceBase ... unfortunately, there is an added bonus with using the Ice::Service class. You can test your code without loading it as a service first, so no need to recompile.

@stephan

Thanks for the suggestion ... will give iceboxnet a try.
__________________
Alex Rufon
jDatabase Development Team
jDatabase - a native database for the J programming language
Reply With Quote
  #5 (permalink)  
Old 09-07-2006
Powell Trusler Powell Trusler is offline
Registered User
 
 
Join Date: Sep 2006
Posts: 8
Hello Alex,
I am working on a C# Ice windows service currently, using ServiceBase, and Ice.Application.

I started with a console app and in my Ice:Application run method I create the communicator, then the object adapter, activate the adapter and then waitForShutdown. When I try the same thing within the context of a service, the service will sort of hang with the waitforshutdown.
If I dont waitforshutdown in the run method, seems to work.

I was wondering, how did you handle waitForShutdown() within the service?

Thanks,
Powell
__________________
Powell Trusler
CitiGroup
Enterprise Infrastructure Tools
Reply With Quote
  #6 (permalink)  
Old 09-11-2006
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
-->
Quote:
Originally Posted by Powell Trusler
Hello Alex,
I am working on a C# Ice windows service currently, using ServiceBase, and Ice.Application.

I started with a console app and in my Ice:Application run method I create the communicator, then the object adapter, activate the adapter and then waitForShutdown. When I try the same thing within the context of a service, the service will sort of hang with the waitforshutdown.
If I dont waitforshutdown in the run method, seems to work.

I was wondering, how did you handle waitForShutdown() within the service?

Thanks,
Powell
Nope. The waitForShutDown() function didn't work for me too. I actually removed that code ...

I'll be looking into C++.NET as soon as I have free time for my project. What I'm thinking is leaving ICE implementation in C++ but the code will call the C# classes which actually does the work.
__________________
Alex Rufon
jDatabase Development Team
jDatabase - a native database for the J programming language
Reply With Quote
  #7 (permalink)  
Old 09-11-2006
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,088
You cannot call waitForShutdown as it blocks the thread until the communicator has been shutdown. If you do this windows thinks your service is broken and assumes it fails. Anyway, you do not need to call waitForShutdown() since the purpose of this is API call is to block the main thread of your application (so it does not terminate your application) until the server is told to terminate. With a windows service you don't have to do this -- the interaction model is different.

I recommend you read Mark Spruiells article in issue 10 of the newsletter. It refers to the C++ Ice::Service class -- however the basic ideas are all the same in C#. If you look at the impl of this class you can see how the hooks into your application are arranged from the core Windows service calls.
Reply With Quote
  #8 (permalink)  
Old 09-14-2006
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
-->
Quote:
Originally Posted by matthew
I recommend you read Mark Spruiells article in issue 10 of the newsletter. It refers to the C++ Ice::Service class -- however the basic ideas are all the same in C#. If you look at the impl of this class you can see how the hooks into your application are arranged from the core Windows service calls.
Thanks for pointing out the article.
__________________
Alex Rufon
jDatabase Development Team
jDatabase - a native database for the J programming language
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
how to add servant class yanhbo Help Center 1 08-19-2005 04:47 AM
Ice.Application class in C# beardo Help Center 9 08-09-2005 01:08 AM
How to trap signal in ICE::Service Class dragzhb Help Center 6 09-15-2004 11:50 PM
Operations in Class yomi Help Center 2 04-10-2004 10:39 PM
bug when pass a class by value damingyipai Bug Reports 2 04-02-2004 03:51 AM


All times are GMT -4. The time now is 12:23 AM.


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