Home Help Center

Proper use of ICEStorm - help needed

Hi everyone,

I'm new to ICE and I just need some clarification. I'm writing a small program which has 1 server and 2 clients (client A and client B). The server tracks the state of both clients and has to notify the state of client A to B and vice-versa. Any change in state in client A will be sent to the server and any change in state in client B will also be sent to the server. It is the server's responibility to update all clients of each others state. My implementation will be in C#.

From reading the docs ICEStorm is seems to be an implementation of the publisher/subscriber paradigm. On a periodic basis the publisher will update it's subscribers with "network events" you could say. Am I correct to say that for a scenario like mine ICEStorm would be ideal to use? Are there any strategies/considerations I should take note of if I'm to use ICEStorm? Or can I do this without ICEStorm? Any help is very much appreciated.


Thanks

John

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi John,

    You could certainly implement this functionality directly in your server. If your configuration is fairly static (e.g., there will always be two clients and one server), then incorporating IceStorm may not offer any significant advantages. However, if the number of publishers or subscribers may vary, or if you need the notion of multiple topics, then IceStorm may be appropriate.

    Take care,
    - Mark
  • johnstv3johnstv3 Member
    Thanks Mark,

    For now there will be 2 clients but in the future I *may* add more clients. If I were to program this functionality within the server then would it be correct to say that the clients will have to behave as a server in order for the server to notify the clients about each other's state? I.e. client calls server (using an object on the server) to tell the server it's state. Every second or so the server calls the client (using an object on the client) to update it about the other client's state. In this respect the definiton of client/server becomes a gray area. Does this sound reasonable to you?


    Thanks

    John
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    John,

    You are understanding things correctly.

    When IceStorm publishes a message, it invokes an operation on a proxy provided by the subscriber. In this respect, it is no different than your custom solution - the client must also be a server.

    - Mark
  • johnstv3johnstv3 Member
    Thanks Mark,

    Your advice is very much appreciated. I like to design my software with extensibility in mind and design my software with the potential for more than 2 clients; ICEStorm may then have to be used. It's just a shame that there are no C# examples to work from but I guess I can use the Java example from the book and work from there (as really both languages are virtually identical). Thanks once again for your help Mark.


    Regards,

    John
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    As far as the code examples are concerned, we didn't go through and add the same code example in C# and VB everywhere because it is usually obvious how to write the equivalent code in C# or VB (even if you are not a Java expert). Having every code example presented in every language would just clutter things up and make the text a lot harder to read.

    Cheers,

    Michi.
  • sionsconesionscone Member Sion SconeOrganization: Loughborough UniversityProject: PhD Robotics
    Getting Started with IceStorm

    Hi

    I am trying to write a system that will allow a group of autonomous robots to collect data from the environment (e.g. location of obstacles) and communicate them amongst a group. I plan to use IceStorm to allow each robot to subscribe to an 'Obstacles' topic and have each one 'publish' new obstacles as they are found. I am coding in C#. Eventually I'd like to combine this with the File Server system (Chapters 15 & 17) so that the data can be stored, does this sound feasible?

    However, I'm finding it very difficult to get started using IceStorm. I have followed the "Using IceStorm" section of the Ice.Book (45.5) but nothing seems to work. So, I have some questions:

    - are the Slice interfaces in sections 45.4.1 (TopicManager), 45.4.2 (Topic), 45.5 (Using IceStorm) meant to be complete and ready to use? when I call "slice2cs" I get a variety of errors. Are those three sections meant to be three files, or all part of the same file?

    - is the rest of the sample code complete (in either C++ or Java)? I have written a C# program based on the Java one, but I get the message "'IceStormPublisher' does not implement inherited abstract member 'Ice.Application.run(string[])'". Is this because of the Slice files?

    - are there any working examples written in C# that I can access? I have downloaded the C++ examples from the Newsletter and also seen the ones in the IceStorm/demo folder; however while all of them compile on my machine (in Visual Studio 2005 under Windows XP), none of them seem to actually do anything when executed. I've read the relevant 'readme' files but whenever any of the .exe files is executed a blank console opens and closes after a few seconds

    I was able to adapt your basic tutorial on client/servers to develop a cooperative search routine, so I'm confident that your systems work, I just cant' seem to get this one off the ground! Any help much appreciated.

    Thanks

    Sion
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Sion,

    The IceStorm slice definitions (IceStorm::Topic, TopicManager etc) are built as part of the Ice build, so you should not build them yourself for each application. In C#, your application should simply use the corresponding assembly (icestormcs.dll).

    We provide an IceStorm demo in C#, democs/IceStorm/clock in the binary distribution; did you try it? It also shows how to use properly the Ice.Application helper class.

    Naturally the demos should output messages to the console. If you don't see anything, please double-check the README directions. You can also trace network activity between these programs by running them with --Ice.Trace.Network=2.

    Best regards,
    Bernard
  • sionsconesionscone Member Sion SconeOrganization: Loughborough UniversityProject: PhD Robotics
    I have tried the cs demo, but it won't build:

    Error 1 The command ""C:\Ice-3.2.1\democs\IceStorm\clock\."\..\bin\generatecs.exe "C:\Ice-3.2.1\democs\IceStorm\clock\." "C:\Ice-3.2.1\democs\IceStorm\clock\." clockC" exited with code 3. clockC

    I had to recreate the file generated/Clock.cs (using slice2cs on Clock.ice) because it was missing from the democs/generated folder, but that hasn't changed the error.

    Is there some reason that none of the demos will build on my system? Do I need to have something special installed? I have Ice 3.2.1, IceBox, IceStorm etc etc and have already written applications using Ice.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Sion,

    All demos should build successfully on your system; otherwise, there is a problem with your Ice installation.

    It's hard to tell what's wrong with so little information. Which operating system version and Visual Studio version do you use? Did you install the Ice binary distribution, or this is your own build? Does any demo (in C++ or C#) build and run properly?

    Best regards,
    Bernard
Sign In or Register to comment.