コード例 #1
0
 public ReceiveEventArgs(Socket socket, ArrayList sockets)
 {
     this.socket = socket;
     this.clients = sockets;
     this.reader = new Reader(this.socket);
     this.writer = new Writer(this.socket);
 }
コード例 #2
0
ファイル: Client.cs プロジェクト: Guoyingbin/HNXC_WCS
 public void Close()
 {
     this.isConnected = false;
     if (this.writer != null)
     {
         this.writer.Close();
         this.writer = null;
     }
     if (this.reader != null)
     {
         this.reader.Close();
         this.reader = null;
     }
     if (this.thread != null)
     {
         this.thread.Abort();
     }
     if (this.client != null)
     {
         this.client.Shutdown(SocketShutdown.Both);
         this.client.Close();
         this.client = null;
     }
 }
コード例 #3
0
ファイル: Client.cs プロジェクト: Guoyingbin/HNXC_WCS
 public void Connect()
 {
     this.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this.client.Connect(new IPEndPoint(IPAddress.Parse(this.hostAddress), this.port));
     this.isConnected = true;
     this.reader = new Reader(this.client);
     this.writer = new Writer(this.client);
     if (this.OnReceive != null)
     {
         this.thread = new Thread(new ThreadStart(this.ReceiveData));
         this.thread.Name = "接收数据";
         this.thread.Start();
     }
 }
コード例 #4
0
ファイル: ClientThread.cs プロジェクト: Guoyingbin/HNXC_WCS
 public ClientThread(Server server, Socket client)
 {
     this.server = server;
     this.socket = client;
     this.writer = new Writer(this.socket);
 }