适用于Windows Mobile 6的RAW套接字 [英] RAW Sockets for Windows Mobile 6

查看:72
本文介绍了适用于Windows Mobile 6的RAW套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个使用RAW Sockets for Windows Mobile的应用程序。根据(http://msdn.microsoft.com/en-us/library/aa922428.aspx)上的信息,新版Windows Mobile支持RAW套接字。我在C#中工作,似乎无法创建一个设置了SIO_RCVALL值的RAW套接字。这是我的代码部分失败:

Socket _socket = new Socket(AddressFamily.InterNetwork,SocketType.Raw,ProtocalType.IP);

_socket.Bind(ipaddress,0);

byte [] _in = new byte [4] {1,0,0,0};
byte []
_out = new byte [4] {1,0,0,0};
int SIO_RCVALL = unchecked((int)0x98000001);

try {

_ socket.IOControl(SIO_RCVALL,_in, _out);

解决方案



你没有以错误的方式使用Socket.IOControl类,因为ReceiveAll是IOControlCode的成员Enumeration等于Win32中的SIO_RCVALL常量。这就是为什么它"代码在Windows XP上编译并运行良好"。


在Windows Mobile中,你必须在这种方式



问候


Hammadi Dali


I am trying to develop an application which uses RAW Sockets for Windows Mobile.  According to the information at (http://msdn.microsoft.com/en-us/library/aa922428.aspx) RAW Sockets are supported on new versions of Windows Mobile.  I am working in C# and cannot seem to create a RAW Socket with the SIO_RCVALL value set.  Here is the portion of my code which fails:

Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocalType.IP);

_socket.Bind(ipaddress,0);

byte[] _in = new byte [4] {1,0,0,0};
byte[]
_out = new byte [4] {1,0,0,0};
int SIO_RCVALL = unchecked ((int)0x98000001);

try{

_socket.IOControl(SIO_RCVALL, _in, _out);

解决方案

 

Hi

You are not using Socket.IOControl class in a wrong way, because ReceiveAll witch is a member of IOControlCode Enumeration is equal to SIO_RCVALL constant in Win32. That is why it "The code compiles and runs fine on Windows XP." 

In windows Mobile you have to use Socket.IOControl in this way.  

 

Regards

Hammadi Dali


这篇关于适用于Windows Mobile 6的RAW套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆