summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CSharp/Ivy/IvyPPC/IvyClient.cs43
1 files changed, 7 insertions, 36 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyClient.cs b/CSharp/Ivy/IvyPPC/IvyClient.cs
index 23c65bb..37a9fde 100644
--- a/CSharp/Ivy/IvyPPC/IvyClient.cs
+++ b/CSharp/Ivy/IvyPPC/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