두 메소드 모두 udp socket에 대해서 사용하는 것인데
아주 심각한 버그가 있다.
ReceiveFromAsync() 의 경우 Completed event 발생 후 RemoteEndpoint가 '가끔' 올바르게 설정되지 않는다.
http://stackoverflow.com/questions/5802998/is-this-receivefromasync-bug
이런 현상이다. (내가 쓴 글임)
밑에 답글에 보면 ReceiveMessageFromAsync()과 SocketAsyncEventArgs.ReceiveMessageFromPacketInfo를 쓰라고 되어있는데
SocketAsyncEventArgs.ReceiveMessageFromPacketInfo.Address 는 항상 null 이다!!!!
여기 있는데로
To ensure that all IPPacketInformation objects are valid, an application should set the PacketInformation socket option to true before it is bound to a local endpoint using the SetSocketOption(SocketOptionLevel, SocketOptionName, Boolean) method.
bind 하기 전에 소켓 옵션을 설정해도 안돼!!!
그래서 찾아보니..
ReceiveMessageFromAsync() 버그는 .NET framework 4.0에서 고쳐졌다고 한다.
아오 빡쳐ㅕ ㅁㄴ이라ㅜㅁㄴ인ㄻㄴㅇ
ReceiveFromAsync() 는 모르겠다. 고쳐졌나? ㅠㅠ
-------------------------------------------------
확인 결과 : ReceiveFromAsync(), ReceiveMessageFromAsync() 의 버그가 닷넷 4.0 에서 모두 fix 되었다.
근데 SocketAsyncEventArgs.ReceiveMessageFromPacketInfo.Address 에는 port가 없다. 으흑흑...
'C#, .NET' 카테고리의 다른 글
class library 의 documentation 생성 (0) | 2011.06.17 |
---|---|
.NET framework 4.0 에서 바뀐 점 (0) | 2011.06.17 |
직접 구현한 MinHeap (0) | 2011.06.17 |
value type에 관한 진실 (0) | 2011.06.17 |
[System.Windows.Forms.Timer], [System.Timers.Timer], [System.Threading.Timer] (0) | 2011.06.17 |