小妹求问:TCPClient实时接收字符串问题!
小妹我写了一个Socket程序!
不能实时接收一接收就是所有返回消息都接收一遍!
每发送一条消息,都在把以前的消息接收一遍,我只想接收最后一条消息,然后输出,并且如果我不发送消息,接收消息的那个线程就死掉了。
请问各位师哥如何解决。
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections;
namespace TcpClientTest
{
class MCC
{
private StreamReader m_Read = null;
private StreamWriter m_Write = null;
private TcpClient tcp;
private Thread m_ReceiveDataThread = null;
private string m_Username = null;
private string m_Password = null;
public void Login()
{
tcp = new TcpClient();
try
{
tcp.Connect( "192.168.1.10 ",8000);
}
catch (Exception ex)