473,378 Members | 1,504 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,378 software developers and data experts.

Remoting TcpChannel Timeout ? ?

Hi

When the remoting server starts and the client immediate begins calling the
remote object on the server no problems.
But when the client does not need to access the remote object for some time
the connection seems to be broken on the next attempt to do a call to the
remote object on the server. (i need to restart the server application to
get it working again ).

So it appears if the remoting connection is idle for some time ( about a
minute max ) the connection seems to break.
When there are regular call it ran for a whole day without problems.

Any way i can fix this ?

Thanks ,
Johan
this is how i ini the remote server
// Register our tcp channel

ChannelServices.RegisterChannel(new TcpChannel(setting.RemotePort), false);

// Register an object created by the server

rmDisplay = new Display(); //inherits from MarshalByRefObject
ObjRef refDisplay = RemotingServices.Marshal(rmDisplay, "Display");




May 10 '06 #1
2 10608
Can you pls tell me is it Client Activated or Server Activated object? The
life time of Marshal by reference remote object is maintained by the Lease,
Lease Manager and several Sponsors. Lease defines the life time of the remote
object. You can either give long time duration for the remote object in
InitializeLifeTimeService or you can implement ISponsor Interface in calling
application and then override RenewLease() to solve this problem

"Sagaert Johan" wrote:
Hi

When the remoting server starts and the client immediate begins calling the
remote object on the server no problems.
But when the client does not need to access the remote object for some time
the connection seems to be broken on the next attempt to do a call to the
remote object on the server. (i need to restart the server application to
get it working again ).

So it appears if the remoting connection is idle for some time ( about a
minute max ) the connection seems to break.
When there are regular call it ran for a whole day without problems.

Any way i can fix this ?

Thanks ,
Johan
this is how i ini the remote server
// Register our tcp channel

ChannelServices.RegisterChannel(new TcpChannel(setting.RemotePort), false);

// Register an object created by the server

rmDisplay = new Display(); //inherits from MarshalByRefObject
ObjRef refDisplay = RemotingServices.Marshal(rmDisplay, "Display");




May 10 '06 #2
Hi

I included some code snippets for illustration

if i start the server app and wait some time before starting the client then
if fails with an exception on the client program.
(saying i need to turn off customErrors ....? )

If i call the methods on a regular basis then no problems..

/////////////// CODE ON SERVER PART (remote display
/////////////////////////

public partial class Form1 : Form
{
....
private Display rmDisplay;
....
#region init code
public Form1()
{
InitializeComponent();

// Register our tcp channel
ChannelServices.RegisterChannel(new TcpChannel(50050), false);

// Register an object created by the server
rmDisplay = new Display();

ObjRef refDisplay = RemotingServices.Marshal(rmDisplay,
"Display");

rmDisplay.RtfMessagebox = this.rtb_meldingen; // pass the
richtextbox on the form to the Display class
rmDisplay.ControlOwner = this; // needed for Control.Invoke

rmDisplay.SetDisplayTiming += new
Display.SetDisplayTimingHandler(rmDisplay_SetDispl ayTiming);
rmDisplay.SetWorkLoadEvent += new
Display.SetWorkLoadHandler(rmDisplay_SetWorkLoadEv ent);
rmDisplay.IncomingEvent += new
Display.IncomingEventHandler(rmDisplay_IncomingEve nt);
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
MyFormatter = new
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
MyFormatter.FilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
}

// rest of source cut
....
....
}

// snippet from display class

class Display : MarshalByRefObject
{
public RichTextBox RtfMessagebox;
public Control ControlOwner;

public delegate void SetDisplayTimingHandler(object sender, int
displaylogo_timeout,int displayoff_timeout);
public event SetDisplayTimingHandler SetDisplayTiming;

public delegate void SetWorkLoadHandler(object sender, int
workload);
public event SetWorkLoadHandler SetWorkLoadEvent;

public delegate void IncomingEventHandler(object sender);
public event IncomingEventHandler IncomingEvent;

public Display()
{

}

delegate void SetTimesCallback(int displaylogo_timeout, int
displayoff_timeout);

// call its own if Control.Invoke is required to avoid cross thread
problems
public void SetTiming(int displaylogo_timeout,int
displayoff_timeout)
{
if (SetDisplayTiming != null)
{
if (ControlOwner.InvokeRequired == false)
SetDisplayTiming(this, displaylogo_timeout,
displayoff_timeout);
else
{
SetTimesCallback d = new SetTimesCallback(SetTiming);
ControlOwner.Invoke(d, new object[] {
displaylogo_timeout, displayoff_timeout });
}
}
}

//rest of code cut
...
...
}


///////////////////// CODE on CLient app. (app controlling the remote
display)

// this function is used on the remote client to call the method on the
server

private void SetTimeLimits(int t_logo,int t_poweroff)
{
TcpClientChannel displaych2 = new TcpClientChannel();
ChannelServices.RegisterChannel(displaych2, false);

Display rDisplay;

rDisplay = (Display)Activator.GetObject(typeof(Display),
"tcp://192.168.1.3:50050/Display");

rDisplay.SetTiming(t_logo, t_poweroff);

ChannelServices.UnregisterChannel(displaych2);
}




"Altaf Al-Amin Najwani" <al**********@gmail.com> wrote in message
news:85**********************************@microsof t.com...
Can you pls tell me is it Client Activated or Server Activated object? The
life time of Marshal by reference remote object is maintained by the Lease, Lease Manager and several Sponsors. Lease defines the life time of the remote object. You can either give long time duration for the remote object in
InitializeLifeTimeService or you can implement ISponsor Interface in calling application and then override RenewLease() to solve this problem

"Sagaert Johan" wrote:
Hi

When the remoting server starts and the client immediate begins calling the remote object on the server no problems.
But when the client does not need to access the remote object for some time the connection seems to be broken on the next attempt to do a call to the remote object on the server. (i need to restart the server application to get it working again ).

So it appears if the remoting connection is idle for some time ( about a
minute max ) the connection seems to break.
When there are regular call it ran for a whole day without problems.

Any way i can fix this ?

Thanks ,
Johan
this is how i ini the remote server
// Register our tcp channel

ChannelServices.RegisterChannel(new TcpChannel(setting.RemotePort), false);
// Register an object created by the server

rmDisplay = new Display(); //inherits from MarshalByRefObject
ObjRef refDisplay = RemotingServices.Marshal(rmDisplay, "Display");




May 10 '06 #3

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

Similar topics

2
by: Ahmet AKGUN | last post by:
Hi; I am trying to make a server that handles db connection pool. Clients use TcpChannel to make a call to this server and get one database connection (OleDbConnection) from pool. But when I...
1
by: Ahmet AKGUN | last post by:
Hi All; I have one server to which clients are connected to via TcpChannel. I start server on one host and establish a client connection from another host via tcpchannel. On client, using...
6
by: Catherine Jones | last post by:
Hi all, we need urgent help in a matter. We are trying to pass a COM object from the client to server and are facing some problems in the same. We've our client in C# as well as the Server...
15
by: Sharon | last post by:
I’m trying to build a generic Publisher-Subscriber that will work over the net, so I’m using the Remoting. I wish that the subscriber user will be notify about the messages sent by the...
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...
7
by: Sharon | last post by:
Hi, I wrote a remoting object and published it like this: public class RemoteLogger : MarshalByRefObject { // Contain some methods... } public class RemoteManager
9
by: Nak | last post by:
Hi there, I have been messing around with remoting in an attempt to create a "shared application" as mentioned in another thread by that name. I have created a singleton object just like the...
4
by: Sharon | last post by:
Hi, I'm using the remoting, and I have a remoting object that has a public event that other processes should register to it. But when the client process is registering to the remote event, it...
0
by: senpark15 | last post by:
Hi EveryBody, I am developing .net remoting application.I have Created server and client application. Server has installed on Two Pc's and cliient have to connect two Pc's and do some...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.