.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Remoting >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Remoting with VB.NET using HttpChannel

Posted By:nishithraj       Posted Date: November 27, 2009    Points: 10    Category: Remoting    URL: http://www.dotnetspark.com  
 

We can transmit the remoting object by either TCPChannel or HTTPChannel.
Here I have illustrated with httpchannel. System.Runtime.Remoting.Channels.http is the Name space to be used here.

Here is a sample for remoting using HttpChannel

public shared sub Main()
dim channel as HttpChannel = new HttpChannel()
ChannelServices.RegisterChannel(channel)
dim t as Type=Type.GetType("Hi,Hello")
dim url as string ="tcp://localhost:portnumber"
RemotingConfiguration.RegisterActivatedClientType(t,url)
dim obj1 as object=Activator.CreateInstance(t)
Console.WriteLine("Enter Name")
dim str as string=Console.Readline()
Console.WriteLine(obj1.greetings(str))
obj1.SetName(str)
Thread.Sleep(10000)
Console.WriteLine(obj1.getName())
end sub


Note:
HttpChannel uses SOAPformatter to serialize the message to XML format.
However as a study the highest performance can gain by using the TCP channel and binary serialization with a Windows Service host than a remoting with http. Because in the windows service it transmits with binary data over raw TCP sockets.



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend