Switch to full style
Project under GPL source codes are posted here
Post a reply

Build distribution applications by remoting(TCP/HTTP)

Sat Nov 08, 2008 1:34 am

 Project Name:   Build distribution applications by remoting(TCP/HTTP)
 Programmer:   John.Jiang
 Type:   NetWork
 Technology:  C#
 IDE:   NONE
 Description:   In this sample describes how to build a distribution application on remoting by Tcp protoco


Server side :
csharp code
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

namespace RemotingSamples
{
public class HelloServer
{

public static void Main(string [] args)
{
TcpServerChannel channel = new TcpServerChannel(8085);
//TcpChannel chan = new TcpChannel(8085);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"Hi",WellKnownObjectMode.SingleCall);
System.Console.WriteLine("<enter> to quite...");
System.Console.ReadLine();

}
}
}

Client
csharp code
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

namespace RemotingSamples
{
public class Client
{
[STAThread]
public static void Main(string [] args)
{
//TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(new TcpClientChannel());
Hello obj = (Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8085/Hi");
if (obj == null) System.Console.WriteLine("Could not find machine!");
else Console.WriteLine(obj.Greeting("John"));
//else Console.WriteLine(obj.HelloMethod("John"));

}
}
}



Attachments
Remoting_Tcp_Mode.zip
(37.42 KiB) Downloaded 894 times

Re: Build distribution applications by remoting(TCP/HTTP)

Sun Jan 20, 2013 9:25 pm

updated.

Post a reply
  Related Posts  to : Build distribution applications by remoting(TCP/HTTP)
 Send parameters using HTTP GET     -  
 Using java in http connection     -  
 http proxy code     -  
 HTTP Server in Java     -  
 Get value from HTTP POST VARS     -  
 What is a Java Applications?     -  
 How to open http connection using j2me     -  
 how to build cell phone app     -  
 Virtual Reality Applications     -  
 Build Calculator in OpenGL     -  

Topic Tags

C# Networking, C# Projects