[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.remoting

RegisterWellKnownServiceType singleton object and instantiation of this singleton.

Sylvain Ross

7/24/2004 1:21:00 AM

Hi,

I'm publishing a class through the
RemotingConfiguration.RegisterWellKnownServiceType, as a Singleton.

Everything works fine. An instance of the published class get created
once a remote client try to access it. Then, since I'm working with
Singleton, every other remote client acessing with this class will be
using the same instance. Great..

The problem is that I would like right after starting (or even at the
same time !) the publishing of my object, to instantiate it.

Yes I can do dim n as new MyPublishedClass() right after the Registering
for publishing. But when the first remote client ask for the published
class, it's creating a brand new object.

I also tried to kind of access my published object from local, like a
remote client would have do, but It doesnt work.


Roughly, I would like to be able to instanciate explicitly a published
object. And this instanciation would be considered as the published
singleton object.


Thx in advance.
4 Answers

Sunny

7/24/2004 2:41:00 AM

0

Hi Sylvain,

MyRemObj myremobj = new MyRemObj();
RemotingServices.Marshal(myremobj, "MyRemObjUri", typeof(myremobj));

And do not use RegisterWellKnown...

Now, all clients will connect on that instance on the uri MyRemObjUri, and
you can access it internally by myremobj.

Sunny

P.S. as part of the education :), please try next time to use
groups.google.com. A simple search of "remoting singleton access locally"
displays at least 10 answers to this question. It is asked every other day.
At least it can save you some time while wait for the answer.

Sylvain Ross wrote:

> Hi,
>
> I'm publishing a class through the
> RemotingConfiguration.RegisterWellKnownServiceType, as a Singleton.
>
> Everything works fine. An instance of the published class get created
> once a remote client try to access it. Then, since I'm working with
> Singleton, every other remote client acessing with this class will be
> using the same instance. Great..
>
> The problem is that I would like right after starting (or even at the
> same time !) the publishing of my object, to instantiate it.
>
> Yes I can do dim n as new MyPublishedClass() right after the Registering
> for publishing. But when the first remote client ask for the published
> class, it's creating a brand new object.
>
> I also tried to kind of access my published object from local, like a
> remote client would have do, but It doesnt work.
>
>
> Roughly, I would like to be able to instanciate explicitly a published
> object. And this instanciation would be considered as the published
> singleton object.
>
>
> Thx in advance.

Malcolm

7/26/2009 8:00:00 PM

0


In article <flcp655fehgcetsa5ngur8k6qpjrkenjov@4ax.com>, Fred J. McCall
<fjmccall@gmail.com> writes
>"La N" <nilita2004NOSPAM@yahoo.com> wrote:
>
>:
>:"Malcolm" <Malcolm@indaal.demon.co.uk> wrote in message
>:news:V2$EIPyBbGbKFwK2@indaal.demon.co.uk...
>:>
>:> In article <7d30i2F27h9beU1@mid.individual.net>, Deirdre Sholto Douglas
>:> <finch.enteract@sbcglobal.net> writes
>:>>Malcolm wrote:
>:>>
>:>>> Your response appears to be entirely predictable
>:>>
>:>>Her post is entirely predictable also, Malcolm...
>:>>you need to observe the dynamic between them
>:>>a bit longer before you decide she's the victim
>:>>and he's the aggressor. Nilita, candidly, is
>:>>no better than Fred, she's just a bit sneakier
>:>>about how she presents it.
>:
>:
>:>>
>:> I've seen the interplay (if that's the right word!) between the two of
>:> them. At the moment, though, it has only been Fred who has attempted to
>:> attack me because he didn't realise in time that I knew a lot more than he
>:> did about a subject which I happen to have worked on professionally for a
>:> great many years :-)
>:>
>:> His comprehension skills leave a lot to be desired, too. It's always
>:> difficult discussing something with someone who has difficulty
>:> understanding the written word. Did you see him accuse me of coming back
>:> to have the last word when I had told him he could have it? What he
>:> completely failed to comprehend was that I wasn't addressing him any
>:> longer but someone else.
>:>
>:
>:But ... but ... it's all *my* fault, Malcolm, don't you see ... ;)
>:
>
>Telling the truth to sound like a lie. How 'cute'...
>
>Pity. You're still ugly to the bone...
>
>[I guess it's too late for you to get a human personality, huh?]
>
Fred's in love!

--
Malcolm

Fred J. McCall

7/26/2009 8:09:00 PM

0

"La N" <nilita2004NOSPAM@yahoo.com> wrote:
:
:I don't like mice, so I found it rather creepy. My daughter has severe
:arachnaphobia, whereas spiders don't bother me. If I were to see a mouse,
:though, I'd jump on top of the nearest table. <shiver>
:

And here I thought all it took to do that was a handful of singles...

"In order to avoid being called a flirt, she always yielded easily."
-- Charles, Count Talleyrand

Fred J. McCall

7/26/2009 10:39:00 PM

0

Deirdre Sholto Douglas <finch.enteract@sbcglobal.net> wrote:

:Malcolm wrote:
:>
:> Did you see him accuse me of coming back
:> to have the last word when I had told him he could have it?
:
:Frankly, no...it would be really nice if one or
:the other of you would take it upon himself to
:edit the length of the posts because I expect
:I'm not the only one who can't be bothered
:wading through an ocean of quoted text to find
:a three word retort.
:

One can't do that with someone like Malcolm, who is apparently
addicted to Stupid Usenet Tricks 101 tactics, since the next thing
they'll do is accuse you of distorting what they've said by removing
anything.

:> What he
:> completely failed to comprehend was that I wasn't addressing him any
:> longer but someone else.
:
:I suspect 75% of the readership didn't have
:enough invested in the outcome to even notice,
:Malcolm.
:
:My original assertion still stands however...
:in this ongoing, unending dynamic between Fred
:and Nilita they are _both_ capable of acting
:like utter sh*tes...the primary difference in
:them is overt versus covert.
:

And, in the final analysis, that makes all the difference.

--
You are
What you do
When it counts.