Total members 11895 |It is currently Tue Dec 03, 2024 5:40 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka






 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 900 times

_________________
Please recommend my post if you found it helpful. ,
java,j2ee,ccna ,ccnp certified .
Author:
Expert
User avatar Posts: 838
Have thanks: 2 time

updated.


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Build distribution applications by remoting(TCP/HTTP)
 Get value from HTTP POST VARS     -  
 Send parameters using HTTP GET     -  
 Using java in http connection     -  
 http proxy code     -  
 HTTP Server in Java     -  
 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
cron






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com