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 / September 2006

Tip: Looking for answers? Try searching our database.

Multiple clients using same remoting object.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Douglas Peterson - 26 Sep 2006 21:03 GMT
I created a simple client and server using the remoting example in the MSDN
Library.

Run the server and client, works fine.

Now run a second instance of the client (at the same time as the first) and
I get the following exception:
"Only one usage of each socket address
(protocol/network address/port) is normally permitted"

Right, need to set the socket option SO_REUSEADDR on the TCP socket!

But I can't figure out how to do this with a TcpChannel. I'm creating the
channel like so:

BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = 8081;
TcpChannel channel = new TcpChannel(props, null, provider);
ChannelServices.RegisterChannel(channel);

The exception occurs within the TcpChannel constructor, so what ever I need
to do, I need to do before this point.
I've searched the docs, I've tried adding various key/value pairs to props
(i.e. socket_ReuseAddress, etc.)
I can't seem to find the answer.

What is the 'correct' way to go about allowing multiple clients to access
the same remoting object?
Spam Catcher - 26 Sep 2006 21:52 GMT
> But I can't figure out how to do this with a TcpChannel. I'm creating
> the channel like so:
[quoted text clipped - 15 lines]
> What is the 'correct' way to go about allowing multiple clients to
> access the same remoting object?

For the clients, don't register a port - use port = 0. That will allow .NET
to dynamically allocate the client port.
Deepak - 28 Sep 2006 15:48 GMT
Another tedious solution is as follows
Look at the list of registered channels and see if your channel is in that
list.if iti is ,then do not register the channel.
Look at the property ChannelServices.RegisteredChannels

> I created a simple client and server using the remoting example in the MSDN
> Library.
[quoted text clipped - 27 lines]
> What is the 'correct' way to go about allowing multiple clients to access
> the same remoting object?

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.