remoting 获取客户端ip地址(远程获取客户端IP地址)
A big copy of work article is really false, in order to solve the problem of obtaining the client IP in Remoting, Google, Baidu a lot of articles,
Are all the same, really mad. But when debugging, the code contribution:
Using Sink, and as to what the Sink is, I don't understand, and I think it's sort of like the Filter pipeline, anyway,
First copy right, can use again.
The following code, in the Remoting server side, do not make changes directly copy, for simple, put the 2 classes are placed in a inside.
/////////////////////////////////////////////////////////////////////////////////
// Begin
Using System;
Using ;
Using ;
Using ;
Using ;
Using ;
Using ;
Using ;
Namespace IServer
{
Public class ClientIPServerSinkProvider: IServerChannelSinkProvider
{
Private IServerChannelSinkProvider next = null;
Public ClientIPServerSinkProvider ()
{
}
Public ClientIPServerSinkProvider (IDictionary properties, ICollection providerData)
{
}
Public void GetChannelData (IChannelDataStore channelData)
{
}
Public IServerChannelSink CreateSink (IChannelReceiver channel)
{
IServerChannelSink nextSink = null;
If (next = = null)
{
NextSink = (channel);
}
Return new ClientIPServerSink (nextSink);
}
Public IServerChannelSinkProvider Next
{
Get {return next}
Set {next = value;}
}
}
Public class ClientIPServerSink: BaseChannelObjectWithProperties, IServerChannelSink, IChannelSinkBase
{
Private IServerChannelSink _next;
Public ClientIPServerSink (IServerChannelSink next)
{
_next = next;
}
Public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, Object state, IMessage MSG, ITransportHeaders headers, Stream stream)
{
}
Public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, Object state, IMessage MSG, ITransportHea
remoting 获取客户端ip地址(远程获取客户端ip地址) 来自淘豆网m.daumloan.com转载请标明出处.