Socket stream redirection using .NET remoting






3.17/5 (5 votes)
May 5, 2004

57985

1614
Redirecting socket stream over HTTP channel with .NET remoting.
Introduction
Since this is my first uploaded project, I will be quite brief.
This simple program uses .NET remoting built in HTTP channel to establish a two-way communication channel between client and server endpoints which is adequate for firewalled and proxy environments.
Basically, at the server end, TCP2HTTPActivator
registers TCP2HTTPServer
which is a MarshalByRefObject
class that exposes a few methods for sending and receiving socket data. When a client connects to the server, it requests a connection to a particular TCP port. Server object opens a connection to the local port and serves as a proxy between client and server sides.
At the client end, TCP2HTTPClient
starts listening at a predetermined port which is used for redirecting the TCP socket data transfer over HTTP channel. When an application connects locally to a defined port, TCP2HTTPClient
feeds the data to the server and backwards via sendTCPStream
and receiveTCPStream
methods.