Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / November 2005

Tip: Looking for answers? Try searching our database.

Remoting problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dincer Uyav - 17 Nov 2005 09:18 GMT
I have socket server application(srvC) which connects to Remoting
server(srvR) acts as an integration server to clients.

Each client connection to srvC handled in a separate thread.
srvC uses one client tcp channel to connect to srvR.
I am using a sink(usersink) at srvC which adds an identifier to
requestheaders for client Id.

First client connects and creates IServerBS from srvC using:
Activator.GetObject(IServerBS,srvR address,clientId);
and when you call IServerBS.method(); in the usersink clientid added to
requestheader successfully.

But when 2nd client connects and calls Activator.GetObject(IServer, srvR
address,newclientId); in another thread  and calls a method; usersink uses
the firstuser's clientid.

I want to ensure that clientId I passed on Activator.GetObject is used in
sink everytime. srvR services are singleton objects. I need a solution on
srvC without doing any changes to remoting server.

Thanks in advance

Dincer Uyav
Dumitru Sbenghe - 22 Nov 2005 12:09 GMT
The third parameter of the Activator.GetObject has the purpose to send
information to the channel and it is used at the client channel setup time
(when all the sinks are created). This is happening only once, when you call
Activator.GetObject for the first time. Because that your client id has the
same value for all subsequent calls.

Dumitru

>I have socket server application(srvC) which connects to Remoting
> server(srvR) acts as an integration server to clients.
[quoted text clipped - 20 lines]
>
> Dincer Uyav
Dincer Uyav - 22 Nov 2005 12:57 GMT
Maybe you did not catch the problem correctly If I make 2 subsequent calls to
Activator.GetObject with different id's in seperate threads it is using the
first one for two but if you make two calls again by waiting sometime it
workes as it is supposed to be.

> The third parameter of the Activator.GetObject has the purpose to send
> information to the channel and it is used at the client channel setup time
[quoted text clipped - 28 lines]
> >
> > Dincer Uyav
Dumitru Sbenghe - 23 Nov 2005 10:08 GMT
It's possible that I didn't understand your problem; but I think I did.

So you call Activator.GetObject passing the user id as a third parameter.
This parameter is passed to IChannelSender.CreateMessageSink of the channel,
which in turn will call in chain all the client channel providers. At this
moment yours UserSinkProvider.CreateMessageSink is called; probably in this
method you save the user id, probably in the sink; and you try to use it in
the ProcessMessage method of the sink for every method call. But this sink
chain building is happening only once.

As I explained to you in the first message, your CreateMessageSink is called
only once during the first Activator.GetObject.

That is what I understand from you description. If is not that you can try
to describe the problem more clearly.

The third parameter of Activator.GetObject is not meant to be used in the
way you try to use it. For this kind of purposes you can use thread local
storage, CallContext or the IPrincipal interface.

Dumitru

> Maybe you did not catch the problem correctly If I make 2 subsequent calls
> to
> Activator.GetObject with different id's in seperate threads it is using
> the
> first one for two but if you make two calls again by waiting sometime it
> workes as it is supposed to be.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.