473,414 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

.NET Remoting.

GTi
I have a program that will act as an Remoting server AND client.

This program can be loaded on one macine or it can be loaded on several
machines.
But it will only be one master program available, all the other is
"clients" handling tasks. The master program will dellegate tasks.

When the program starts it will ask if there is any "master" available
on the network (a BROADCAST to all machines). If there is no master
responds it will act as a master. Then it will look for clients. If
there is no clients available it will do all the client and server work
itself.
If a master program respond it will act as a client.

I have looked at .NET remoting and I have several questions:

When testing I put the server and client in the same program but when
registering the client I get a error:

[console printout]
The name of the channel is tcp.
The priority of the channel is 1.
The channel URI is tcp://10.47.26.120:9090.
The object URL is tcp://10.47.26.120:9090/RemoteObject.rem.
The object URI is /RemoteObject.rem.
The channel URI is tcp://10.47.26.120:9090.

Unhandled Exception: System.Runtime.Remoting.RemotingException: The
channel 'tcp' is already registered. at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannelInternal(IChannel
chnl) at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(IChannel
chnl)
at WindowsAgent.Program.Main(String[] args) in
C:\prog\WindowsAgent\Program.cs:line 111
Press any key to continue . . .

Does anyone have any tip of how I can solve my problem?
Using CLR 2.0

Nov 17 '05 #1
4 5783
GTi
I have also testet with:
TcpServerChannel (on the server part of my program)
and
TcpClientChannel (on the client part of my program)
instead of using only TcpChannel
But with the same result.

Nov 17 '05 #2
Without seeing your code, it's impossible to say. However, it would
seem that you have already registered the tcp channel.

Are you registering it in your config file perhaps in addition to code?

Also, as a side note, I think designing the client and the server in the
same program is a bad idea. If anything, you should segregate out the
functionality, as things like this are usually difficult to maintain.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GTi" <tu****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a program that will act as an Remoting server AND client.

This program can be loaded on one macine or it can be loaded on several
machines.
But it will only be one master program available, all the other is
"clients" handling tasks. The master program will dellegate tasks.

When the program starts it will ask if there is any "master" available
on the network (a BROADCAST to all machines). If there is no master
responds it will act as a master. Then it will look for clients. If
there is no clients available it will do all the client and server work
itself.
If a master program respond it will act as a client.

I have looked at .NET remoting and I have several questions:

When testing I put the server and client in the same program but when
registering the client I get a error:

[console printout]
The name of the channel is tcp.
The priority of the channel is 1.
The channel URI is tcp://10.47.26.120:9090.
The object URL is tcp://10.47.26.120:9090/RemoteObject.rem.
The object URI is /RemoteObject.rem.
The channel URI is tcp://10.47.26.120:9090.

Unhandled Exception: System.Runtime.Remoting.RemotingException: The
channel 'tcp' is already registered. at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannelInternal(IChannel
chnl) at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(IChannel
chnl)
at WindowsAgent.Program.Main(String[] args) in
C:\prog\WindowsAgent\Program.cs:line 111
Press any key to continue . . .

Does anyone have any tip of how I can solve my problem?
Using CLR 2.0

Nov 17 '05 #3
GTi
I think using the same program as server and client makes it easier to
maintain. Perhaps the server/client program is a bad term. Let me
explain it:

This program can run on several machines, when it does it must be able
to communicate with each other (Like here I am, how are you, My name is
10.34.1.45 ). So I need to set up a tcp listen channel (server) and a
tcp sending channel (client). On the client channel I must be able to
broadcast a message to all machines on the lan. And the server channel
receives this broadcast and send a message back directly to the client
(or a broadcast depending of the message).

Doing this on two different program don't make sense to me.
I have done this in C/C++ with MailSlots. Put I don't want to p/Invoke
this API to C# since I think there is similar functions available.
[This is the simple test program]
///////////////////////////////////////////////////////////
// Create the server channel.
TcpServerChannel serverChannel = new TcpServerChannel(9090);

// Register the server channel.
ChannelServices.RegisterChannel(serverChannel);

// Show the name of the channel.
Console.WriteLine("The name of the channel is {0}.",
serverChannel.ChannelName);

// Show the priority of the channel.
Console.WriteLine("The priority of the channel is {0}.",
serverChannel.ChannelPriority);

// Show the URIs associated with the channel.
ChannelDataStore data = (ChannelDataStore)serverChannel.ChannelData;
foreach (string uri in data.ChannelUris)
{
Console.WriteLine("The channel URI is {0}.", uri);
}

// Expose an object for remote calls.
RemotingConfiguration.RegisterWellKnownServiceType (typeof(RemoteObject),
"RemoteObject.rem", WellKnownObjectMode.Singleton);

// Parse the channel's URI.
string[] urls = serverChannel.GetUrlsForUri("RemoteObject.rem");
if (urls.Length > 0)
{
string objectUrl = urls[0];
string objectUri;
string channelUri = serverChannel.Parse(objectUrl, out objectUri);
Console.WriteLine("The object URL is {0}.", objectUrl);
Console.WriteLine("The object URI is {0}.", objectUri);
Console.WriteLine("The channel URI is {0}.", channelUri);
}

// Wait for the user prompt.
// Console.WriteLine("Press ENTER to exit the server.");
// Console.ReadLine();


///////////////////////////////////////////////////
// Create the channel.
TcpClientChannel clientChannel = new TcpClientChannel();
// Register the channel.
ChannelServices.RegisterChannel(clientChannel);

// Register as client for remote object.
WellKnownClientTypeEntry remoteType = new
WellKnownClientTypeEntry(typeof(RemoteObject),
"tcp://localhost:9090/RemoteObject.rem");
RemotingConfiguration.RegisterWellKnownClientType( remoteType);

// Create a message sink.
string cobjectUri;
System.Runtime.Remoting.Messaging.IMessageSink messageSink =
clientChannel.CreateMessageSink("tcp://localhost:9090/RemoteObject.rem",
null, out cobjectUri);
Console.WriteLine("The URI of the message sink is {0}.", cobjectUri);
if (messageSink != null)
{
Console.WriteLine("The type of the message sink is {0}.",
messageSink.GetType().ToString());
}

// Create an instance of the remote object.
RemoteObject service = new RemoteObject();

// Invoke a method on the remote object.
Console.WriteLine("The client is invoking the remote object.");
for (int a = 0; a < 100; a++)
{
Console.WriteLine("The remote object has been called {0} times.",
service.GetCount());
}



Nicholas Paldino [.NET/C# MVP] wrote:
Without seeing your code, it's impossible to say. However, it would
seem that you have already registered the tcp channel.

Are you registering it in your config file perhaps in addition to code?

Also, as a side note, I think designing the client and the server in the
same program is a bad idea. If anything, you should segregate out the
functionality, as things like this are usually difficult to maintain.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GTi" <tu****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a program that will act as an Remoting server AND client.

This program can be loaded on one macine or it can be loaded on several
machines.
But it will only be one master program available, all the other is
"clients" handling tasks. The master program will dellegate tasks.

When the program starts it will ask if there is any "master" available
on the network (a BROADCAST to all machines). If there is no master
responds it will act as a master. Then it will look for clients. If
there is no clients available it will do all the client and server work
itself.
If a master program respond it will act as a client.

I have looked at .NET remoting and I have several questions:

When testing I put the server and client in the same program but when
registering the client I get a error:

[console printout]
The name of the channel is tcp.
The priority of the channel is 1.
The channel URI is tcp://10.47.26.120:9090.
The object URL is tcp://10.47.26.120:9090/RemoteObject.rem.
The object URI is /RemoteObject.rem.
The channel URI is tcp://10.47.26.120:9090.

Unhandled Exception: System.Runtime.Remoting.RemotingException: The
channel 'tcp' is already registered. at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannelInternal(IChannel
chnl) at
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(IChannel
chnl)
at WindowsAgent.Program.Main(String[] args) in
C:\prog\WindowsAgent\Program.cs:line 111
Press any key to continue . . .

Does anyone have any tip of how I can solve my problem?
Using CLR 2.0


Nov 17 '05 #4
GTi
// Remote object.
public class RemoteObject : MarshalByRefObject
{
private int callCount = 0;

public int GetCount()
{
callCount++;
return (callCount);
}
}

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sean Newton | last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security assemblies. I've been trying to set these up in a very straightforward harness in the way that I'd like to be able to...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
0
by: Martijn Damen | last post by:
Hi, At the moment I am trying to develop an application that uses another app over .net remoting and having some problems with it (ok, that is ofcourse why I am here), hope somebody can shine a...
8
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged...
2
by: erbilkonuk | last post by:
Hi, I am very new to .NET Remoting and I try to run a simple program to subscribe to an event raised by Remoting Class. The Remoting Server initiates an instance of Remoting Class as Singleton /...
0
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false);...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.