473,378 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

writing a service that broadcasts events to its controllers and isremotely callable

hi,

I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??

Could someone tell me how its possible in each technology and which
would be
the simplest to implement.

I'm trying to write a data service that serves and receives
data[represented
by objects] and should broadcast a notification when the data has been
updated.

Thanks so much
Sep 1 '08 #1
6 1148
giddy wrote:
hi,

I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??

Could someone tell me how its possible in each technology and which
would be
the simplest to implement.

I'm trying to write a data service that serves and receives
data[represented
by objects] and should broadcast a notification when the data has been
updated.

Thanks so much
You can do it via direct socket connections.
If you need to "discover" your server from a client you can do a UDP
broadcast where your server would have to respond and then initiate a
direct connection.

JB

-- Posted on news://freenews.netfront.net - Complaints to ne**@netfront.net --
Sep 1 '08 #2
Yea I know I could do it that way, but I was hoping to learn a little
about distributed apps by trying this with remoting or WCF both of
which I know nothing about.

I just managed to learn how to call an object over a network with the
remoting classes but I still havn't managed to figure out a way to
control/call an instance of a class over a network.
So could anyone tell me how to accomplish this with remoting or WCF.

Thanks so much
Gideon
Sep 1 '08 #3
"giddy" <gi*******@gmail.comwrote in message
news:a0**********************************@v13g2000 pro.googlegroups.com...
I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??
It's not clear what you mean by "plain .NET" - there's no such thing as far
as RPC is concerned. You can, of course, do it using WCF or .NET Remoting,
by hosting the corresponding listener thread inside your service process.
Could someone tell me how its possible in each technology and which
would be the simplest to implement.
For details on making your application a WCF or .NET Remoting service host,
see the two following MSDN articles:

http://msdn.microsoft.com/en-us/library/ms730935.aspx
http://msdn.microsoft.com/en-us/library/ecc85927.aspx

They are fully applicable to any type of application, including a Windows
service.

Sep 1 '08 #4
hi,

You will have to excuse my illeteracy with remoting I've bee
researching a LOT today and I found out about things like
RemotingConfiguration . RegisterWellKnownServiceType.

There is one problem with it, how do I allow an *instance* of an
object to be callable across processes?

Something like:

App2:
TextBox txtBox1;

TcpServerChannel channel = new TcpServerChannel(9988);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(TextBox),
"TextBox", WellKnownObjectMode.SingleCall);//***can't i say txtBox1??
***

App2:
ChannelServices.RegisterChannel(new TcpChannel(),false);
TextBox t = (TextBox)Activator.GetObject(typeof(TextBox), "tcp://
localhost:9988/TextBox");
t.ForeColor = Color.Blue;
//Doesn't work!!?

Thanks so much

Sep 1 '08 #5

"giddy" <gi*******@gmail.comwrote in message
news:54**********************************@q26g2000 prq.googlegroups.com...
hi,

You will have to excuse my illeteracy with remoting I've bee
researching a LOT today and I found out about things like
RemotingConfiguration . RegisterWellKnownServiceType.

There is one problem with it, how do I allow an *instance* of an
object to be callable across processes?
You provide a factory as a well-known type that exposes the rest of the
objects in your application via properties and methods such as GetTextBox().
On the client, you obtain instance of that type, and then call its methods
to get proxies for those objects.

One thing, though. If you're doing remote calls over the network, I would
strongly advise to avoid traditional instance-centric object-oriented
approach in the remoting layer, and implement a stateless remote facade
instead. There are numerous reasons to do so, having to do with performance
as well as reliability, and rather than going into detail here, I'll just
refer you to the description of the remote facade pattern:

http://martinfowler.com/eaaCatalog/remoteFacade.html
http://martinfowler.com/eaaCatalog/d...ferObject.html

In this case, you can stick to using well-known types and SingleCall. For
..NET remoting, this also avoids lifetime management issues, which can get
messy with large object graphs.
Sep 1 '08 #6
hi,

Thanks so much for your reply. The facade finally makes more sense to
me now!!

I got exactly what I was looking for from this article though:
http://www.codeproject.com/KB/IP/remotinggui.aspx

He uses RemotingServices.Marshal() whichallows one to register an
*instance*.
I want to bother you with just one more thing.

On the server:

TcpChannel channel = new TcpChannel(9988);
ChannelServices.RegisterChannel(channel,false);
RemotingServices.Marshal(textBox1, "textBox");

And on the client:
ChannelServices.RegisterChannel(new TcpChannel(), false);
t = (TextBox)Activator.GetObject(typeof(TextBox), "tcp://localhost:
9988/textBox");
//t.TextChanged += new EventHandler(t_TextChanged); //works fine
untill i add THIS line.

Tells me:
Type System.DelegateSerializationHolder and the types derived from it
(such as System.DelegateSerializationHolder) are not permitted to be
deserialized at this security level.

I searched online and tried changing some filter setting to full
through config files, doesn't work, and I tried it with code I get a
TargetInvocationException, I'm probably doing something silly, could
you please help!?

Thanks so much

Gideon
Sep 2 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Marian Aldenhövel | last post by:
Hi, I am using the FMOD audio-library with the pyFMOD python bindings. pyFMOD uses ctypes. It is possible to register callback functions with FMOD that are called at certain points in the...
0
by: Yage | last post by:
Hi, im developing a small app in compact framework. This app sends Udp broadcasts to 0.0.0.0 (this is needed because the machine can be in multiple subnets and broadcasts need to be sent to each...
23
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
11
by: TheBurgerMan | last post by:
Hi all. I am using W2K3, .NET2 on a machine running AD and Exchange. I started getting the message below last week. I googled the error and not much was returned, but I did find this;...
1
by: tim | last post by:
Someone using Python Midi Package from http://www.mxm.dk/products/public/ lately? I want to do the following : write some note events in a midi file then after doing that, put some controllers...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
0
by: Gianmaria Iaculo - NVENTA | last post by:
Hi there, i found a nice article about a custom implementation of events by Duncan Booth here: http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#observer The code is here: ...
1
by: Susan Harris | last post by:
I have a Windows (NT) service developed in .NET 3.5 (VS2008). I want this service to log messages to a WinForms application that will display it's progress to the user. It has to run under Vista,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.