Up:Tutorial?


The aim of this tutorial is to explain how to create a service provider for SIGVerse using Microsoft Visual Studio.

We will create a simple service provider as example to send messages to a specified entity of the SIGVerse virtual world from the client side to the server side.

Microsoft Visual Studio 2008 will be used as a development tool.

Creation of the Service Provider

Downloading the libraries

We first need to download SIGVerse libraries, to do so, go to the service libraries web page and download the appropriate version.

Creating a new project

Now let's create a new project on MVS 2008.

Go to: File -> New Project , then select Empty Project, enter the project name "MyService" and press Ok.

Right click on Source Files -> Add -> New Item -> C++ File (.cpp), then enter "MyService.cpp" in the Name field.

Service sample

Now let's create our example.

Copy/past the following code to MyService.cpp file:

MyService.cpp

Replace the hostname and port number with your server arguments.

Setting the library

Extract the libraries in MyService project directory.

Go to the MVS, Right click on the project, and go to properties.

Add the include directory

  • Go to Configuration Properties -> C/C++ -> General -> Additional Include Directories, and specify the following path:
    • "..\SIGService_v2-1-0\include"

Add the library directory

  • Then, go to linker -> General -> Additional Library Directories, and add the following path:
    • "..\SIGService_v2-1-0\lib\Debug"

Add the "SIGService.lib" library

  • In Linker -> Input -> Additional Dependencies, and add the following library:
    • SIGService.lib

Server

In the server side, we have to create the controller and the world file.

Controller

controller.cpp

World file

worl.xml

Running the service

  • Server side:

In the server side, compile and run the the controller:

$ cd path-to-the-controller
$ make
$ sigserver.sh -w ./world.xml
  • In the client side:
  • Run SIGViewer
  • Start the service provider

In the server side you will see the following message:

$ [MSG]  man_000(0.0.0.0) Hello

Registering the plugin

To register the plugin in SIGViewer, you have to follow these steps:

1- Rename the MyService.exe in debug directory to MyService.sig.

2- Run SIGVIewer, go to Services -> Add, then click on Add button.

3- Select the path to the MyService.sig file and press OK.

MyService.PNG

4- To run the service, go to Services -> Start -> MyService.sig.

Counter: 2505, today: 2, yesterday: 0

Attach file: fileMyService.PNG 1484 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2014-02-06 (Thu) 13:33:24 (2727d)