summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:46:35 +0000
committerfcolin2007-02-01 09:46:35 +0000
commit8bef89eb7044b96dc0ae643b5c6e21cbe751f5c4 (patch)
tree76b83b17ade4c6c61385cb10216c42334c687c6c /CSharp/Ivy
parenteb9bc7087ec628a06897bddb3712894f7ec98a29 (diff)
downloadivy-csharp-8bef89eb7044b96dc0ae643b5c6e21cbe751f5c4.zip
ivy-csharp-8bef89eb7044b96dc0ae643b5c6e21cbe751f5c4.tar.gz
ivy-csharp-8bef89eb7044b96dc0ae643b5c6e21cbe751f5c4.tar.bz2
ivy-csharp-8bef89eb7044b96dc0ae643b5c6e21cbe751f5c4.tar.xz
Utilisateur : Fcolin Date : 14/01/05 Heure : 19:01 Archivé dans $/CSharp/Ivy Commentaire: remove TcpClient & MyTCpClient use directly Socket (vss 20)
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/Ivy/IvyClient.cs43
1 files changed, 7 insertions, 36 deletions
diff --git a/CSharp/Ivy/Ivy/IvyClient.cs b/CSharp/Ivy/Ivy/IvyClient.cs
index 23c65bb..37a9fde 100644
--- a/CSharp/Ivy/Ivy/IvyClient.cs
+++ b/CSharp/Ivy/Ivy/IvyClient.cs
@@ -15,36 +15,6 @@ namespace IvyBus
using System.Net.Sockets;
using System.Configuration;
- /// <summary> A private Class for the the peers on the bus.
- /// </summary>
- internal class MyTcpClient : TcpClient
- {
- public IPAddress RemoteAddress
- {
- get
- {
- IPEndPoint ep = (IPEndPoint)Client.RemoteEndPoint;
- return ep.Address;
- }
-
- }
- public int RemotePort
- {
- get
- {
- IPEndPoint ep = (IPEndPoint)Client.RemoteEndPoint;
- return ep.Port;
- }
-
- }
- public MyTcpClient(string host,int port):base(host,port)
- {
- }
- public MyTcpClient(Socket sock)
- {
- Client = sock;
- }
- }
/// <summary> A Class for the the peers on the bus.
/// </summary>
/// <remarks>
@@ -91,7 +61,7 @@ namespace IvyBus
{
get
{
- IPHostEntry hostInfo = Dns.GetHostByAddress(socket.RemoteAddress);
+ IPHostEntry hostInfo = Dns.GetHostByAddress(((IPEndPoint)socket.RemoteEndPoint).Address);
return hostInfo.HostName;
}
@@ -100,7 +70,7 @@ namespace IvyBus
{
get
{
- return socket.RemotePort;
+ return ((IPEndPoint)socket.RemoteEndPoint).Port;
}
}
@@ -128,7 +98,7 @@ namespace IvyBus
private static int clientSerial = 0; /* an unique ID for each IvyClient */
private Ivy bus;
- private MyTcpClient socket;
+ private Socket socket;
private StreamWriter out_stream;
private StreamReader in_stream;
private Hashtable regexp_in;
@@ -145,7 +115,7 @@ namespace IvyBus
// protected variables
internal String appName;
- internal IvyClient(Ivy bus, MyTcpClient socket)
+ internal IvyClient(Ivy bus, Socket socket)
{
regexp_in = Hashtable.Synchronized(new Hashtable());
regexp_text = Hashtable.Synchronized(new Hashtable());
@@ -154,8 +124,9 @@ namespace IvyBus
this.bus = bus;
this.socket = socket;
clientKey = clientSerial++;
- out_stream = new StreamWriter(socket.GetStream(),System.Text.Encoding.ASCII);
- in_stream = new StreamReader(socket.GetStream(),System.Text.Encoding.ASCII);
+ NetworkStream net_stream = new NetworkStream( socket );
+ out_stream = new StreamWriter(net_stream,System.Text.Encoding.ASCII);
+ in_stream = new StreamReader(net_stream,System.Text.Encoding.ASCII);
// sends our ID, whether we initiated the connexion or not
// the ID is the couple "host name,application Port", the host name
// information is in the socket itself, the port is not known if we