Ahmet
I don't think you can set a timeout on a tcp connection from .NET remoting.
I tried to find a solution, the only timeout you can set is on a channel
sink of a http channel.
You have some alternatives.
1.You can use async invoke of remoting functions using delegates
2.You can use a timer from System.Threadin g namespace, start the timer when
the function start (the timer will run in separate thread) and on timer
event to try invoke again from example
Here is a code that shows how to use async invoke:
//this is a delegate with the same signature with the function to invoke
public delegate Stream GetRestoreStrea mDelegate(Authe nticationInfo
info,String backupName,
String folderName,Stri ng fileName,ItemIn fo files);
//this is the code that performes the invoke
srv=(RemotingSe rver)Activator. GetObject(typeo f(RemotingServe r),Settings.Ser v
erName);
GetRestoreStrea mDelegate d;
d=new GetRestoreStrea mDelegate(srv.G etRestoreStream );
AsyncCallback cb;
cb=new AsyncCallback(G etRestoreStream Result);
Object state;
state=new Object();
IAsyncResult ar;
ar=d.BeginInvok e(info,strCateg ory,folderName, strFileName,(It emInfo)tvwFiles .
Tag,null,null);
//the function WaitOne will finished either if a result is received either
if a timeout is reached
ar.AsyncWaitHan dle.WaitOne(180 0000,false);
//this is the callback function that receives the result of call
public void GetRestoreStrea mResult(IAsyncR esult ar)
{
GetRestoreStrea mDelegate d;
d=(GetRestoreSt reamDelegate)(( AsyncResult)ar) .AsyncDelegate;
d.EndInvoke(ar) ;
}
Hope this helps
Dan Cimpoiesu
"Ahmet AKGUN" <ak*********@ho tmail.com> wrote in message
news:e3******** ******@TK2MSFTN GP10.phx.gbl...
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 activators, I try to invoke one function on server side
using channel
After first successfull fucntion invoke, I unplug ethernet cable on server
side and
make another call from client side.
Only after 2.3 minutes, on client side a System.Net socket exception is
thrown and server side is unaware
about that conneciton is broken !!.
Can anybody help me with the way of minimizing this timeout value or
making both client and server
side aware of that connection is broken in a short time ?
Helps'll be appreciated..
Ahmet