이 내가 설정 내 TCP 서버문제는
internal void Initialize(int port,string IP)
{
IPEndPoint _Point = new IPEndPoint(IPAddress.Parse(IP), port);
Socket _Accpt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
_Accpt.Bind(_Point);
}
catch (SocketException exc)
{
System.Windows.Forms.MessageBox.Show(exc.Message);
}
finally
{
_Accpt.Listen(2); //Second exception is here after the code continues after the catch block
_Accpt.BeginAccept(null, 0, new AsyncCallback(Accept), _Accpt);
}
}
에 사용하는 코드입니다 그 함수를 두 번 호출하면 예외가 생깁니다.
문제점 - Catch {} 문 다음에 나는 예외를 잡았음에도 불구하고 finally {}를 계속 수행합니다. 그 이유는 무엇입니까? messagebox 뒤에 함수를 종료하고 싶습니다. "return"을 시도했지만 finally {} 블록을 계속 따라갑니다.