Similar Threads:
1.Registering two Singleton remoting object on two different ports on the same machine
Hi.
I have an standard Win32 .NET application that uses a remoting entry
point for add-in applications to communicate with it.
Multiple instances of the Win32 application can be started on the same
machine at the same time (eg. different users logged in simultaneously
via Citrix or other). I facilitate this feature by dynamically
allocating a port when the application starts up. I do this by starting
at a configured port catching socket exceptions and simply incrementing
the port. When I find a port that doesn't generate a Socket bind
exception I write that value to the current user registry and add-ins
for the current user will read this port and connect.
My problem lies in the fact that even though the second instance of the
Win32 application will find a port and register a sever channel on it -
it doesn't start listening on that port. Only the first instance
started will actually bind to a port and start listening. I know this
for a fact since I'm looking at netlimiter for the two instances, and I
can see that only instance no. 1 is listening.
I'm just wondering WHY oh why I don't get any kind of exception during
this procedure. The below sample runs as I expect it. The first
RegisterChannel creates a socket exception and I increment the port.
The second iteration doesn't and that port is used.
while (!found || (findRemotingPortRetryCount == 0))
{
IDictionary props = new Hashtable();
props["typeFilterLevel"] = "Full";
BinaryServerFormatterSinkProvider formatterProvider = new
BinaryServerFormatterSinkProvider(props, null);
try
{
ChannelServices.RegisterChannel(new TcpServerChannel("MyChannel",
startRemotingPort,
formatterProvider), true);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(HostApplicationRemotingEntryPoint),
"MyObjectUri",
WellKnownObjectMode.Singleton);
}
catch (SocketException)
{
startRemotingPort++;
findRemotingPortRetryCount--;
}
found = true;
}
2.Making sure an Element Group contains elements with either two attributes or one attribute
3.Found two different objects associated with the same URI
4.Registering same Singleton remoting object on two different ports on the same machine
Hi.
I have an standard Win32 .NET application that uses a remoting entry
point for add-in applications to communicate with it.
Multiple instances of the Win32 application can be started on the same
machine at the same time (eg. different users logged in simultaneously
via Citrix or other). I facilitate this feature by dynamically
allocating a port when the application starts up. I do this by starting
at a configured port catching socket exceptions and simply incrementing
the port. When I find a port that doesn't generate a Socket bind
exception I write that value to the current user registry and add-ins
for the current user will read this port and connect.
My problem lies in the fact that even though the second instance of the
Win32 application will find a port and register a sever channel on it -
it doesn't start listening on that port. Only the first instance
started will actually bind to a port and start listening. I know this
for a fact since I'm looking at netlimiter for the two instances, and I
can see that only instance no. 1 is listening.
I'm just wondering WHY oh why I don't get any kind of exception during
this procedure. The below sample runs as I expect it. The first
RegisterChannel creates a socket exception and I increment the port.
The second iteration doesn't and that port is used.
while (!found || (findRemotingPortRetryCount == 0))
{
IDictionary props = new Hashtable();
props["typeFilterLevel"] = "Full";
BinaryServerFormatterSinkProvider formatterProvider = new
BinaryServerFormatterSinkProvider(props, null);
try
{
IChannel channel =
ChannelServices.GetChannel("HostApplicationChannel" +
startRemotingPort);
ChannelServices.RegisterChannel(new TcpServerChannel("MyChannel",
startRemotingPort,
formatterProvider), true);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(HostApplicationRemotingEntryPoint),
"HostApplication" + startRemotingPort,
WellKnownObjectMode.Singleton);
}
catch (SocketException)
{
startRemotingPort++;
findRemotingPortRetryCount--;
}
found = true;
}
5.Deep copy between two different object.
There are two objects, instants of two different class, but they has
same schema.
Class ClientDivision
{
public string Name
{
get {}; set {};
}
public string Manager
{
get {}; set {};
}
}
Class ClientPerson
{
public string Name
{
get {}; set {};
}
public int Age
{
get {}; set {};
}
public Division div
{
get {}; set {};
}
}
Class ServerDivision
{
public string Name
{
get {}; set {};
}
public string Manager
{
get {}; set {};
}
}
Class ServerPerson
{
public string Name
{
get {}; set {};
}
public int Age
{
get {}; set {};
}
public Division div
{
get {}; set {};
}
}
I have a instant of ClientPerson and need to build a ServerPerson with
the value from ClientPerson. The following code is what I do that job
now.
ServerPerson sPerson = new ServerPerson();
sPerson.Name = cPerson.Name;
sPerson.Age = cPerson.Age;
sPerson.Div = new ServerDivision();
sPerson.Div.Name = cPerson.Div.Name;
sPerson.Div.Manager = cPerson.Div.Manager;
Like you see, all value pass statement wrote by my hand. It's ok when
the class's struct is simple. But will be a large work when it's
complex. In last few days, I even wrote about 300 lines of code just
for copy the value. As you know, nobody will like coding in this way.
So, I'm thinking to find or write a "Deep copy" like tool to do that
job for me. Is anyone has seen a tool like this?
6. How to serialize two different objects into one XML file
7. Get data from two different servers with two threads
8. Running two IIS's on two different 2003 server machines