//Accept 콜백 메소드 //Begin ReceiveLength 메소드 public void HandleAsyncAccept(IAsyncResult asyncResult) { Socket listenSock = (Socket)asyncResult.AsyncState; Socket clientSock; try { clientSock = listenSock.EndAccept(asyncResult); } catch { clientSock = null; Console.WriteLine("DataReceiver::HandleAsyncAccept.EndAccept 에러"); } if (clientSock != null) { Console.WriteLine(clientSock.RemoteEndPoint.ToString() + " 접속"); ConnectionChecker.AddClient(clientSock); AsyncData asyncData = new AsyncData(clientSock); clientSock.BeginReceive(asyncData.msg, 0, UnityServer.packetLength, SocketFlags.None, asyncReceiveLengthCallBack, (Object)asyncData); } listenSock.BeginAccept(asyncAcceptCallback, (Object)listenSock); }