IPAddress ipAddress = IPAddress.Parse(ip);
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, SPort);
Array.Resize(ref SckSs, 1);
SckSs[0] = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SckSs[0].Bind(localEndPoint);
SckSs[0].Listen(50);
//20171214
byte[] bytes;
Socket handler = SckSs[0].Accept();
string data = null;
while (true)
{
bytes = new byte[1024];
try
{
int bytesRec = handler.Receive(bytes);
data += Encoding.ASCII.GetString(bytes, 0, bytesRec);
if (data.IndexOf("<EOF>") > -1)
{
break;
}
}
catch (ThreadAbortException e)
{
Console.WriteLine("{0} Error code: {1}.", e.Message);
}
catch (SocketException e)
{
Console.WriteLine("{0} Error code: {1}.", e.Message, e.ErrorCode);
}
catch(Exception e)
{
Console.WriteLine("{0} Error code: {1}.", e.Message);
}
}
断点放在int bytesRec = handler.Receive(bytes);进入断点后F10直接跳出了断点,没有继续执行下一步,也没有任何报错和进catch。这是和传送的数据有关系吗?
有没有大神 求告知!谢谢!!!