473,672 Members | 2,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ServiceControll er.

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 1157
giddy wrote:
hi,

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

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.n et --
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*******@gmai l.comwrote in message
news:a0******** *************** ***********@v13 g2000pro.google groups.com...
I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceControll er.

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
RemotingConfigu ration . RegisterWellKno wnServiceType.

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;

TcpServerChanne l channel = new TcpServerChanne l(9988);
ChannelServices .RegisterChanne l(channel);
RemotingConfigu ration.Register WellKnownServic eType(typeof(Te xtBox),
"TextBox", WellKnownObject Mode.SingleCall );//***can't i say txtBox1??
***

App2:
ChannelServices .RegisterChanne l(new TcpChannel(),fa lse);
TextBox t = (TextBox)Activa tor.GetObject(t ypeof(TextBox), "tcp://
localhost:9988/TextBox");
t.ForeColor = Color.Blue;
//Doesn't work!!?

Thanks so much

Sep 1 '08 #5

"giddy" <gi*******@gmai l.comwrote in message
news:54******** *************** ***********@q26 g2000prq.google groups.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
RemotingConfigu ration . RegisterWellKno wnServiceType.

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 RemotingService s.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 .RegisterChanne l(channel,false );
RemotingService s.Marshal(textB ox1, "textBox");

And on the client:
ChannelServices .RegisterChanne l(new TcpChannel(), false);
t = (TextBox)Activa tor.GetObject(t ypeof(TextBox), "tcp://localhost:
9988/textBox");
//t.TextChanged += new EventHandler(t_ TextChanged); //works fine
untill i add THIS line.

Tells me:
Type System.Delegate SerializationHo lder and the types derived from it
(such as System.Delegate SerializationHo lder) 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
TargetInvocatio nException, 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
2585
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 processing pipeline or when certain events happen. I am expecially interested in the one that fires when a currently playing stream ends. This is what the declaration in pyFMOD looks like:
0
2002
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 one), broadcasts are sent and received as expected, but, when i receive them (using UdpClient.Receive(ref IPEndPoint)) the endpoint is filled with the primary network address of the sender, not with the address associated with the subnet which...
23
7576
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 unrecoverable error occurs. When that case occurs, I create a ServiceController object and call the Stop() method. However - I get an exception thrown saying access denied. If I switch to using the LocalService account it works fine, but I lose...
11
45266
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; http://forums.asp.net/918725/ShowPost.aspx I tried both items in the forum and it works for a few hits then it happens again! Anyone have the same problem? How do I fix this?
1
2099
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 at the beginning of the midifile (because I want to be able to make those dependant on what notes were just written)
4
21718
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 webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
0
1071
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: STEP 1) Define a Delegate Class
1
2285
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, so I can't use an interactive service. The monitoring application will just display a list of these log entries as they arrive. I'd like to use WCF (using it to consume a third party web service already). However, I can't fnd any examples that...
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.