HighTechTalks DotNet Forums  

TCP Remoting

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss TCP Remoting in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
dotnet_nut
 
Posts: n/a

Default TCP Remoting - 12-27-2004 , 05:07 PM






I am receiving the following error:

"An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in mscorlib.dll

Additional information: No connection could be made because the target
machine actively refused it"

while trying to connect to a server using a TCP channel hosted in a windows
service.

Any ideas to the cause? Do i need to do some kinda of setup on the server to
open the TCP port (I am wunning win 200 advanced server for client and server
and just started working on Remoting..;->)


I am attaching the server and client code

Server Object
----------------
public class Container : MarshalByRefObject
{
public Container()
{
//
// TODO: Add constructor logic here
//
}

public override object InitializeLifetimeService()
{
// this lets us keep the object around as long as the process hosting
them are running
return null;
}


private string containerName = "Testing";


public string MachineName
{
get
{
return System.Environment.MachineName;
}
}

public int ProcessId
{
get
{
return System.Diagnostics.Process.GetCurrentProcess().Id;
}
}

private string GetContainerName()
{
return containerName;
}


public string GivemeContainerName()
{
return GetContainerName();
}

public void ChangeContainerName(string values)
{
containerName = values;
}

}




Client Code
--------------

Hashtable properties = new Hashtable();
properties.Add("name", "TcpBinary");
BinaryClientFormatterSinkProvider formatter = new
BinaryClientFormatterSinkProvider();

TcpChannel channel = new TcpChannel(properties, formatter, null);
ChannelServices.RegisterChannel(channel)
RemotingConfiguration.RegisterWellKnownClientType( typeof(BusinessEntity.Container), "tcp://10.18.5.187:1002/RemoteHTTPHost/BusinessEntity.rem");

properties = null;
formatter = null;
channel = null;


Reply With Quote
  #2  
Old   
Ken Kolda
 
Posts: n/a

Default Re: TCP Remoting - 12-27-2004 , 05:20 PM






Can you show the server code that you use to register your channel? Should
look something like:

TcpChannel channel = new TcpChannel(1002);
ChannelServices.RegisterChannel(channel);

Ken


"dotnet_nut" <dotnetnut (AT) discussions (DOT) microsoft.com> wrote

Quote:
I am receiving the following error:

"An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in mscorlib.dll

Additional information: No connection could be made because the target
machine actively refused it"

while trying to connect to a server using a TCP channel hosted in a
windows
service.

Any ideas to the cause? Do i need to do some kinda of setup on the server
to
open the TCP port (I am wunning win 200 advanced server for client and
server
and just started working on Remoting..;->)


I am attaching the server and client code

Server Object
----------------
public class Container : MarshalByRefObject
{
public Container()
{
//
// TODO: Add constructor logic here
//
}

public override object InitializeLifetimeService()
{
// this lets us keep the object around as long as the process hosting
them are running
return null;
}


private string containerName = "Testing";


public string MachineName
{
get
{
return System.Environment.MachineName;
}
}

public int ProcessId
{
get
{
return System.Diagnostics.Process.GetCurrentProcess().Id;
}
}

private string GetContainerName()
{
return containerName;
}


public string GivemeContainerName()
{
return GetContainerName();
}

public void ChangeContainerName(string values)
{
containerName = values;
}

}




Client Code
--------------

Hashtable properties = new Hashtable();
properties.Add("name", "TcpBinary");
BinaryClientFormatterSinkProvider formatter = new
BinaryClientFormatterSinkProvider();

TcpChannel channel = new TcpChannel(properties, formatter, null);
ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownClientType( typeof(BusinessEntity.Cont
ainer), "tcp://10.18.5.187:1002/RemoteHTTPHost/BusinessEntity.rem");
Quote:
properties = null;
formatter = null;
channel = null;




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.