diff options
author | fcolin | 2007-02-01 09:58:01 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 09:58:01 +0000 |
commit | cbbe84bec3aca732a890feea74ceef6eeee70d4e (patch) | |
tree | 08b80c6e733d45d52c906598cfe1edefe34f5644 /CSharp/Ivy/IvyPPC/IvyClient.cs | |
parent | 231e9641b1bf6fbdf5fa94f22b5174570b0ce6fd (diff) | |
download | ivy-csharp-cbbe84bec3aca732a890feea74ceef6eeee70d4e.zip ivy-csharp-cbbe84bec3aca732a890feea74ceef6eeee70d4e.tar.gz ivy-csharp-cbbe84bec3aca732a890feea74ceef6eeee70d4e.tar.bz2 ivy-csharp-cbbe84bec3aca732a890feea74ceef6eeee70d4e.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/IvyPPC/IvyClient.cs')
-rw-r--r-- | CSharp/Ivy/IvyPPC/IvyClient.cs | 43 |
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
|