2010-04-14 5 views
0

Active Sync 네트워크를 통해 Windows Mobile 장치로 보낸 모든 패킷을 수신 할 소켓을 열려고합니다. 특히 CS Network Sniffer for WindowsWindows Mobile 6 - .net Socket advice [Compact Framework 3.5]

:

전에서 코드를 사용하고

//For sniffing the socket to capture the packets has to be a raw socket, with the 
//address family being of type internetwork, and protocol being IP 
mainSocket = new Socket(AddressFamily.InterNetwork, 
    SocketType.Raw, ProtocolType.IP); 

//Bind the socket to All Network Communication 
mainSocket.Bind(new IPEndPoint(IPAddress.Parse("169.254.2.1"), 0)); 

나는 Active Sync를

을 통해 IP 설정에 특이 적으로 결합하고있어 다음과 같은 소켓 옵션을 사용할 수 없습니다 Windows Mobile에서 동일한 효과를 얻으려면 Windows Mobile에서 사용할 수있는 다른 옵션이 있습니까?

//Start receiving the packets asynchronously 
mainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, 
    new AsyncCallback(OnReceive), null); 

다시 - 내가 많은 도움이되지 않습니다 MSDN에서 본 목록은 마지막으로 코드 받기

//Set the socket options 
mainSocket.SetSocketOption(SocketOptionLevel.IP, //Applies only to IPv4 packets 
          SocketOptionName.HeaderIncluded, 
          true);       

byte[] byTrue = new byte[4] { 1, 0, 0, 0 }; 
byte[] byOut = new byte[4] { 1, 0, 0, 0 };  //Capture outgoing packets 

//Socket.IOControl is analogous to the WSAIoctl method of Winsock 2 
//IOControlCode.ReceiveAll is equivalent to SIO_RCVALL constant of Winsock 2 
mainSocket.IOControl(IOControlCode.ReceiveAll, byTrue, byOut); 

을 msdn.microsoft.com/en-us/library/aa926870.aspx 내 목표는 Active Sync 네트워크를 통해 내 Windows Mobile Device에서 TCP 및 UDP에 대한 모든 포트에서 들어오는 모든 패킷을 수신하는 것입니다. 도움말, 조언 또는 코드를 매우 높이 평가합니다. C#, VB.net, C++ 모두 좋습니다 :)

답변

0

CE는 소켓 수준에서 수행중인 작업을 실제로 수행 할 수 없습니다. 들어오는 모든 패킷을 검사하고 처리 할 수있는 NDIS Intermediate driver을 만들고 설치하는 것이 훨씬 낫습니다.

참고로 ActiveSync 연결은 전체 네트워크 연결이 아니라 부분적 RNDIS 연결입니다. 일부 패킷 유형은 전달되지 않습니다 (예를 들어 ICMP가 마음에 듭니다).

또한 ActiveSync 주소를 하드 코딩하지 마십시오. 이전에 변경되었으므로 향후에 변경 될 수 있습니다. 대신 주소를 얻기 위해 "ppp-peer"에 대한 DNS 확인을하십시오.

관련 문제