[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Accessing "Server" Win Forms Application from Server Class

Alex Maghen

8/13/2004 6:07:00 PM

Hi. I've built the exact example given in the KB-307445 and related articles
(Creating a remote server in C#.NET). Everything works great. Now here's
where I need some help:

In the examples, they say to build a DLL which contains the "ServerClass"
(that which will be accessed by the client application). THEN, you have to
create a RemoteServer EXE which sets up the Listening, etc. That's fine.

My question is this: How can I provide my "ServerClass" access to the
classes that make up the RemoteServer EXE? For example, let's say that my
RemoteServer EXE is actually a windows application and it has a Form,
"MainForm". And let's say that MainForm has a public method "TurnGreen()".
How can I have my ServerClass - which is defined in a separate DLL - get a
reference to my MainForm so that it can call "MainForm.TurnGreen()"?

Thanks!

Alex
2 Answers

Ken Kolda

8/13/2004 7:28:00 PM

0

You've got a a few choices for how to do this. My recommendation would be
that you not put your actual server class in the shared DLL. Instead, just
define an interface and put it in there. Then, in your RemoteServer
executable, create a class that implements that interface and remote that
class. That way your implementation class is in the same assembly as your
forms and it also keeps the client from needing to have the server-side code
in order to function.

For a more in-depth explanation of how to program interface-based remoting,
check out:

http://www.genuinechannels.com/Content.aspx?id=28&...

and

http://msdn.microsoft.com/architecture/patterns/default.aspx?pull=/library/en-us/dnpatterns/html/ImpBroker...

Ken


"Alex Maghen" <AlexMaghen@discussions.microsoft.com> wrote in message
news:4BA3B468-6D6A-40D5-A3E7-E433CA1DB8DB@microsoft.com...
> Hi. I've built the exact example given in the KB-307445 and related
articles
> (Creating a remote server in C#.NET). Everything works great. Now here's
> where I need some help:
>
> In the examples, they say to build a DLL which contains the "ServerClass"
> (that which will be accessed by the client application). THEN, you have to
> create a RemoteServer EXE which sets up the Listening, etc. That's fine.
>
> My question is this: How can I provide my "ServerClass" access to the
> classes that make up the RemoteServer EXE? For example, let's say that my
> RemoteServer EXE is actually a windows application and it has a Form,
> "MainForm". And let's say that MainForm has a public method "TurnGreen()".
> How can I have my ServerClass - which is defined in a separate DLL - get a
> reference to my MainForm so that it can call "MainForm.TurnGreen()"?
>
> Thanks!
>
> Alex


Alex Maghen

8/13/2004 7:55:00 PM

0

I'll give these a look-see. I think it answers my question. We'll see. Thanks!

"Ken Kolda" wrote:

> You've got a a few choices for how to do this. My recommendation would be
> that you not put your actual server class in the shared DLL. Instead, just
> define an interface and put it in there. Then, in your RemoteServer
> executable, create a class that implements that interface and remote that
> class. That way your implementation class is in the same assembly as your
> forms and it also keeps the client from needing to have the server-side code
> in order to function.
>
> For a more in-depth explanation of how to program interface-based remoting,
> check out:
>
> http://www.genuinechannels.com/Content.aspx?id=28&...
>
> and
>
> http://msdn.microsoft.com/architecture/patterns/default.aspx?pull=/library/en-us/dnpatterns/html/ImpBroker...
>
> Ken
>
>
> "Alex Maghen" <AlexMaghen@discussions.microsoft.com> wrote in message
> news:4BA3B468-6D6A-40D5-A3E7-E433CA1DB8DB@microsoft.com...
> > Hi. I've built the exact example given in the KB-307445 and related
> articles
> > (Creating a remote server in C#.NET). Everything works great. Now here's
> > where I need some help:
> >
> > In the examples, they say to build a DLL which contains the "ServerClass"
> > (that which will be accessed by the client application). THEN, you have to
> > create a RemoteServer EXE which sets up the Listening, etc. That's fine.
> >
> > My question is this: How can I provide my "ServerClass" access to the
> > classes that make up the RemoteServer EXE? For example, let's say that my
> > RemoteServer EXE is actually a windows application and it has a Form,
> > "MainForm". And let's say that MainForm has a public method "TurnGreen()".
> > How can I have my ServerClass - which is defined in a separate DLL - get a
> > reference to my MainForm so that it can call "MainForm.TurnGreen()"?
> >
> > Thanks!
> >
> > Alex
>
>
>