* TcpChannel.cs: Fixed line endings. Set eol-style to native.
* TcpServerTransportSink.cs: Fixed line endings. Set eol-style to
native.
* TcpConnectionPool.cs: Fixed line endings. Set eol-style to CRLF.
* TcpClientTransportSinkProvider.cs: Fixed line endings. Set eol-style
to native.
* TcpMessageIO.cs: Set eol-style to native.
* TcpServerChannel.cs: Fixed line endings. Set eol-style to native.
* TcpClientTransportSink.cs: Fixed line endings. Set eol-style to
native.
svn path=/trunk/mcs/; revision=61302
+2006-05-31 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * TcpClientChannel.cs: Set eol-style to native.
+ * TcpChannel.cs: Fixed line endings. Set eol-style to native.
+ * TcpServerTransportSink.cs: Fixed line endings. Set eol-style to
+ native.
+ * TcpConnectionPool.cs: Fixed line endings. Set eol-style to CRLF.
+ * TcpClientTransportSinkProvider.cs: Fixed line endings. Set eol-style
+ to native.
+ * TcpMessageIO.cs: Set eol-style to native.
+ * TcpServerChannel.cs: Fixed line endings. Set eol-style to native.
+ * TcpClientTransportSink.cs: Fixed line endings. Set eol-style to
+ native.
+
2005-11-08 Lluis Sanchez Gual <lluis@novell.com>
* TcpServerChannel.cs: Fix null ref exception.
{
public class TcpChannel : IChannelReceiver, IChannel, IChannelSender
{
- private TcpClientChannel _clientChannel;\r
- private TcpServerChannel _serverChannel = null;\r
- private string _name = "tcp";\r
+ private TcpClientChannel _clientChannel;
+ private TcpServerChannel _serverChannel = null;
+ private string _name = "tcp";
private int _priority = 1;
public TcpChannel ()
{
- Init (new Hashtable(), null, null);\r
+ Init (new Hashtable(), null, null);
}
public TcpChannel (int port)
{
- Hashtable ht = new Hashtable();\r
- ht["port"] = port.ToString();\r
- Init(ht, null, null);\r
+ Hashtable ht = new Hashtable();
+ ht["port"] = port.ToString();
+ Init(ht, null, null);
}
- void Init (IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)\r
- {\r
- _clientChannel = new TcpClientChannel (properties,clientSink);\r
+ void Init (IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)
+ {
+ _clientChannel = new TcpClientChannel (properties,clientSink);
+
+ if(properties["port"] != null)
+ _serverChannel = new TcpServerChannel(properties, serverSink);
- if(properties["port"] != null)\r
- _serverChannel = new TcpServerChannel(properties, serverSink);\r
-\r
object val = properties ["name"];
if (val != null) _name = val as string;
val = properties ["priority"];
if (val != null) _priority = Convert.ToInt32 (val);
- }\r
-\r
+ }
+
public TcpChannel (IDictionary properties,
IClientChannelSinkProvider clientSinkProvider,
Init (properties, clientSinkProvider, serverSinkProvider);
}
- public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)\r
- {\r
- return _clientChannel.CreateMessageSink(url, remoteChannelData, out objectURI);\r
- }\r
-\r
- public string ChannelName\r
- {\r
- get { return _name; }\r
- }\r
-\r
- public int ChannelPriority\r
- {\r
- get { return _priority; }\r
- }\r
-\r
- public void StartListening (object data)\r
- {\r
- if (_serverChannel != null) _serverChannel.StartListening (data);\r
- }\r
- \r
- public void StopListening (object data)\r
- {\r
- if (_serverChannel != null) _serverChannel.StopListening(data);\r
- TcpConnectionPool.Shutdown ();\r
- }\r
-\r
- public string[] GetUrlsForUri (string uri)\r
- {\r
- if (_serverChannel != null) return _serverChannel.GetUrlsForUri(uri);\r
- else return null;\r
- }\r
-\r
- public object ChannelData\r
- {\r
- get \r
- {\r
- if (_serverChannel != null) return _serverChannel.ChannelData;\r
- else return null;\r
- }\r
- }\r
+ public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
+ {
+ return _clientChannel.CreateMessageSink(url, remoteChannelData, out objectURI);
+ }
+
+ public string ChannelName
+ {
+ get { return _name; }
+ }
+
+ public int ChannelPriority
+ {
+ get { return _priority; }
+ }
+
+ public void StartListening (object data)
+ {
+ if (_serverChannel != null) _serverChannel.StartListening (data);
+ }
+
+ public void StopListening (object data)
+ {
+ if (_serverChannel != null) _serverChannel.StopListening(data);
+ TcpConnectionPool.Shutdown ();
+ }
+
+ public string[] GetUrlsForUri (string uri)
+ {
+ if (_serverChannel != null) return _serverChannel.GetUrlsForUri(uri);
+ else return null;
+ }
+
+ public object ChannelData
+ {
+ get
+ {
+ if (_serverChannel != null) return _serverChannel.ChannelData;
+ else return null;
+ }
+ }
public string Parse (string url, out string objectURI)
{
// Lluis Sanchez Gual (lluis@ideary.com)
//
// 2002 (C) Copyright, Ximian, Inc.
-//\r
+//
//
// Permission is hereby granted, free of charge, to any person obtaining
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System;\r
-using System.Runtime.Remoting.Channels;\r
-using System.Runtime.Remoting.Messaging;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Threading;\r
-\r
-namespace System.Runtime.Remoting.Channels.Tcp\r
-{\r
+
+using System;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Messaging;
+using System.Collections;
+using System.IO;
+using System.Threading;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
internal class TcpClientTransportSink : IClientChannelSink
{
string _host;
public IDictionary Properties
{
- get \r
+ get
{
return null;
}
public IClientChannelSink NextChannelSink
{
- get \r
+ get
{
// we are the last one
return null;
}
-\r
-}\r
+
+}
// Lluis Sanchez (lsg@ctv.es)
//
// 2002 (C) Copyright, Ximian, Inc.
-//\r
+//
//
// Permission is hereby granted, free of charge, to any person obtaining
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System;\r
-using System.Runtime.Remoting.Channels;\r
-\r
-namespace System.Runtime.Remoting.Channels.Tcp\r
-{\r
+
+using System;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
internal class TcpClientTransportSinkProvider : IClientChannelSinkProvider
{
public TcpClientTransportSinkProvider ()
public IClientChannelSinkProvider Next
{
- get \r
+ get
{
return null;
}
- set \r
+ set
{
// ignore, we are always the last in the chain
}
{
return new TcpClientTransportSink (url);
}
- }\r
-}\r
+ }
+}
//\r
// 2002 (C) Lluis Sanchez Gual\r
//\r
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
+\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
\r
using System;\r
using System.Collections;\r
}\r
\r
\r
-}
+}\r
void Init (IServerChannelSinkProvider serverSinkProvider)
{
- if (serverSinkProvider == null) \r
+ if (serverSinkProvider == null)
{
serverSinkProvider = new BinaryServerFormatterSinkProvider ();
}
// Gets channel data from the chain of channel providers
channel_data = new ChannelDataStore (null);
- IServerChannelSinkProvider provider = serverSinkProvider;\r
- while (provider != null)\r
- {\r
- provider.GetChannelData(channel_data);\r
- provider = provider.Next;\r
- }\r
+ IServerChannelSinkProvider provider = serverSinkProvider;
+ while (provider != null)
+ {
+ provider.GetChannelData(channel_data);
+ provider = provider.Next;
+ }
// Creates the sink chain that will process all incoming messages
- IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain (serverSinkProvider, this);\r
+ IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain (serverSinkProvider, this);
sink = new TcpServerTransportSink (next_sink);
}
IServerChannelSinkProvider serverSinkProvider)
{
foreach(DictionaryEntry property in properties)
- {\r
- switch((string)property.Key)\r
- {\r
+ {
+ switch((string)property.Key)
+ {
case "name":
name = property.Value.ToString();
break;
- case "port":\r
+ case "port":
port = Convert.ToInt32(property.Value);
- break;\r
- case "priority":\r
+ break;
+ case "priority":
priority = Convert.ToInt32(property.Value);
- break;\r
- case "bindTo":\r
+ break;
+ case "bindTo":
bindAddress = IPAddress.Parse((string)property.Value);
- break;\r
- case "rejectRemoteRequests":\r
+ break;
+ case "rejectRemoteRequests":
if(Convert.ToBoolean(properties["rejectRemoteRequests"]))
bindAddress = IPAddress.Loopback;
break;
case "supressChannelData":
supressChannelData = Convert.ToBoolean (property.Value);
- break;\r
+ break;
case "useIpAddress":
useIpAddress = Convert.ToBoolean (property.Value);
break;
case "machineName":
host = property.Value as string;
break;
- }\r
+ }
}
Init (serverSinkProvider);
}
return "tcp://" + host + ":" + port;
}
- public string[] GetUrlsForUri (string uri)\r
- {\r
+ public string[] GetUrlsForUri (string uri)
+ {
if (!uri.StartsWith ("/")) uri = "/" + uri;
-\r
- string [] chnl_uris = channel_data.ChannelUris;\r
- string [] result = new String [chnl_uris.Length];\r
-\r
- for (int i = 0; i < chnl_uris.Length; i++) \r
- result [i] = chnl_uris [i] + uri;\r
- \r
- return result;\r
- }\r
+
+ string [] chnl_uris = channel_data.ChannelUris;
+ string [] result = new String [chnl_uris.Length];
+
+ for (int i = 0; i < chnl_uris.Length; i++)
+ result [i] = chnl_uris [i] + uri;
+
+ return result;
+ }
public string Parse (string url, out string objectURI)
{
stopped = false;
#endif
listener = new TcpListener (bindAddress, port);
- if (server_thread == null) \r
+ if (server_thread == null)
{
threadPool = RemotingThreadPool.GetSharedPool ();
listener.Start ();
#endif
listener.Stop ();
threadPool.Free ();
- server_thread.Join ();\r
- server_thread = null; \r
+ server_thread.Join ();
+ server_thread = null;
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;\r
-using System.Collections;\r
-using System.Runtime.Remoting.Messaging;\r
-using System.IO;\r
-\r
-namespace System.Runtime.Remoting.Channels.Tcp\r
-{\r
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
internal class TcpServerTransportSink : IServerChannelSink, IChannelSinkBase
{
IServerChannelSink next_sink;
next_sink = next;
}
- public IServerChannelSink NextChannelSink \r
+ public IServerChannelSink NextChannelSink
{
- get \r
+ get
{
return next_sink;
}
}
- public IDictionary Properties \r
+ public IDictionary Properties
{
- get \r
+ get
{
if (next_sink != null) return next_sink.Properties;
else return null;
IMessage msg, ITransportHeaders headers, Stream responseStream)
{
ClientConnection connection = (ClientConnection)state;
- TcpMessageIO.SendMessageStream (connection.Stream, responseStream, headers, connection.Buffer);\r
+ TcpMessageIO.SendMessageStream (connection.Stream, responseStream, headers, connection.Buffer);
}
public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
// Reads the headers and the request stream
Stream requestStream;
- ITransportHeaders requestHeaders;\r
+ ITransportHeaders requestHeaders;
requestStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out requestHeaders, connection.Buffer);
requestHeaders [CommonTransportKeys.IPAddress] = connection.ClientAddress;
if (uri != null)
requestHeaders [CommonTransportKeys.RequestUri] = uri;
- \r
- // Pushes the connection object together with the sink. This information\r
- // will be used for sending the response in an async call.\r
-\r
- ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();\r
- sinkStack.Push(this, connection);\r
-\r
- ITransportHeaders responseHeaders;\r
- Stream responseStream;\r
- IMessage responseMsg;\r
-
- ServerProcessing proc = next_sink.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);\r
-\r
- switch (proc)\r
- {\r
- case ServerProcessing.Complete:\r
- TcpMessageIO.SendMessageStream (connection.Stream, responseStream, responseHeaders, connection.Buffer);\r
- break;\r
-\r
- case ServerProcessing.Async:\r
- case ServerProcessing.OneWay:\r
- break;\r
- }\r
+
+ // Pushes the connection object together with the sink. This information
+ // will be used for sending the response in an async call.
+
+ ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();
+ sinkStack.Push(this, connection);
+
+ ITransportHeaders responseHeaders;
+ Stream responseStream;
+ IMessage responseMsg;
+
+ ServerProcessing proc = next_sink.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);
+
+ switch (proc)
+ {
+ case ServerProcessing.Complete:
+ TcpMessageIO.SendMessageStream (connection.Stream, responseStream, responseHeaders, connection.Buffer);
+ break;
+
+ case ServerProcessing.Async:
+ case ServerProcessing.OneWay:
+ break;
+ }
}
- }\r
-}\r
-\r
+ }
+}
+