Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / December 2004

Tip: Looking for answers? Try searching our database.

TCP Remoting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dotnet_nut - 27 Dec 2004 23:07 GMT
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;
Ken Kolda - 27 Dec 2004 23:20 GMT
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

> I am receiving the following error:
>
[quoted text clipped - 76 lines]
> 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");

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.