Crystal Space
Welcome, Guest. Please login or register.
November 21, 2017, 01:02:02 pm

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80565 Members
Latest Member: Travisrogers1265
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Eventhandling
« previous next »
Pages: [1] Print
Author Topic: Eventhandling  (Read 4683 times)
Full Member
Posts: 101

View Profile
« on: February 15, 2005, 01:49:42 pm »

I am writing networking-support for my application:

o My server is waiting for incoming data (type: char*).
o When data arrives, the servercode fires an event.
o This event is caught by my networkingmodule which has an eventqueue and computes the received data.

Now I have some questions:

1) My server inherits from iEventOutlet and does the following:

this->netevent = CreateEvent();

what do I have to insert into "XXX"?
I guess I have to use
virtual bool iEvent::Add   (   const char *   name,
  const char *   v

-> "const char* v" will be my my received data?
what shall "const char* name" be?

2) My networking-module inherits from csBaseEventHandler.
I know I will use one of the several methods to compute my event-data but how do I catch events from the server-code?
There should be a "link" in the code between server and netmodule, but how can I establish it?

3) What is the difference between broadcasts and commands?

Gentoo Linux ~x86, kernel 2.6.11-cko9 smp, gcc 3.4.4-r1, binutils 2.16.1, glibc 2.3.5 NPTL
CS+CEL Pseudo Stable 2005.09.03
Full Member
Posts: 101

View Profile
« Reply #1 on: February 15, 2005, 02:24:27 pm »

1) was answered in the CS-IRC: v will be my data and name will be "netevent"

2) EventPlug -> Outlet -> Queue is the link between these classes, but I stiil don't know how to use this.

Gentoo Linux ~x86, kernel 2.6.11-cko9 smp, gcc 3.4.4-r1, binutils 2.16.1, glibc 2.3.5 NPTL
CS+CEL Pseudo Stable 2005.09.03
Posts: 3
View Profile WWW
« Reply #2 on: February 16, 2005, 12:41:30 am »

1) You should inherit from iEventPlug, not iEventSocket. A reference to an iEventSocket is provided to you by the event queue.

2) Register your event handler with the RegisterListener method in iEventQueue.

3) Broadcast is a type of command where the handler's return value is ignored. Usually, if a handler returns true, the event is marked as handled and not passed to any other handlers. Broadcasts are sent to all handlers regardless.

The Tao has already created the code. I only have to find it and write it down.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.818 seconds with 16 queries.