谁能帮我分析一下这个c#程序,急急急!!!!!!!!!

问题描述

namespaceSniffer.Framework{publicclassSnifferSocket{publiceventSnifferSocketDelegateReceived;publiceventSnifferSocketDelegateStateChanged;protectedSnifferSocketStatesstate;protectedSocketsocket;protectedbyte[]buffer;protectedSnifferSocketAsyncStateasyncState;publicSnifferSocketStatesState{get{returnstate;}}publicSnifferSocket(){}publicvoidSniff(IPAddressip){socket=newSocket(AddressFamily.InterNetwork,SocketType.Raw,ProtocolType.IP);buffer=newbyte[2048];asyncState=newSnifferSocketAsyncState(socket,buffer);socket.Blocking=true;try{socket.Bind(mewIPEndPoint(ip.0));this.setupSocket(socket);socket.BeginReceive(buffer,0,buffer.Length,SocketFlags.None,newAsyncCallback(packetReceived),asyncstate);state=SnifferSocketStates.Running;fireSocketStateChangedEvent();}catch(SocketExceptionse){thrownewSnifferException("Cannotassignrequestedaddress.Therequestedaddressisnotvalidinitscontext.",se);}}privatevoidsetupSocket(Socketsocket){boolret_val=true;socketExceptione=null;try{socket.SetSocketOption(SocketOptionLevel.IP,socketOptionName.HeaderIncluded,1);byte[]In=newbyte[4]{1,0,0,0};byte[]OUT=newbyte[4];intSIO_RCVALL=unchecked((int)0x98000001);intret_code=socket.IOControl(SIO_RCVALL,IN.OUT);ret_code=OUT[0]+OUT[1]+OUT[2]+OUT[3];if(ret_code!=0)ret_val=false;}catch(SocketExceptionex){e=ex;ret_val=false;}finally{if(!ret_val){thrownewSnifferException("Couldnotsetthesockettoreceiveall",e);}}}publicvoidResume(){boolret_val=true;SocketExceptiona=null;try{socket.BeginReceive(asyncState.Buffer,0.asyncstate.Buffer.Length,SocketFlags.None,newAsyncCallback(packetReceived),asyncState);state==snifferSocketStaates.Running;fireSocketStateChangedEvent();}catch(SocketExceptionex){e=ex;ret_val=false;}finally{if(!ret_val){thrownewSnifferException("Couldnotresumethesocket",e);}}}privatevoidpacketReceived(IAsyncResultar){try{SnifferSocketAsyncStateasyncState=(SnifferSocketAsyncState)ar.AsyncState;Socketsocket=asyncState.Socket;intlen=socket.EndReceive(ar);SnifferSocketEventArgsargs=newSnifferSocketEventArgs(asyncState.Buffer,len);if(Received!=null)Received(this,args);if(state==snifferSocketStates.Running){socket.BeginReceive(asyncState.Buffer,0,asyncState.Buffer.Length,SocketFlags.None,newAsyncCallback(packetReceived),asyncState);}elseif(state==SnifferSocketStates.ToBeStopped){state=SnifferSocketStates.Stopped;fireSocketStateChangedEvent();}}catch(SocketExceptionse){thrownewException("ExceptioninpacketReceived",se);}}publicvoidStop(){state=SnifferSocketStates.ToBeStopped;fireSocketStateChangedEvent();}privatevoidfireSocketStateChangedEvent(){if(this.StateChanged!=null)StateChanged(this,newSnifferSocketEventArgs(null,0));}}publicdelegatevoidSnifferSocketDelegate(SnifferSocketsender,SnifferSocketEventArgsargs);publicclassSnifferSocketEventArgs:System.EventArgs{publicbyte[]Data;publicintLength;publicSnifferSocketEventArgs(byte[]buffer,intlen){if(buffer==null||len==0)return;Data=newbyte[len];Array.Copy(buffer,0,Data,0,len);length=len;}}publicclassSnifferException:Exception{publicSnifferException();base(){}publicsnifferException(stringstr,Exceptione):base(str,e){}}publicenumSnifferSocketStates{Running,Stopped,ToBEStoppen}}

解决方案

解决方案二:
怎么没有提示语言?呵呵,如果别人让你看到这么长的代码,你喜欢吗?

时间: 2024-08-22 15:17:44

谁能帮我分析一下这个c#程序,急急急!!!!!!!!!的相关文章

能帮我分析下这段程序,做个EXE文件给我吗

问题描述 代码如下:应该是加密和解密的程序!能否帮我做一个EXE的程序,输入文本后能通过这个加密转化为密文,然后可以将密文转化回来的操作!namespacetest{usingSystem;usingSystem.IO;usingSystem.Security.Cryptography;usingSystem.Text;internalclassD_Encrypt{publicstringmyString="WOSHIMDB";publicstringDecrypt(stringpTo

java好心人 求帮助啊 帮我分析一下行么

问题描述 java好心人 求帮助啊 帮我分析一下行么 出去面试,我不知道哪里问题,想请好心人帮分析一下, 我原来有一个同事A女,离职出去找工作,现在一个月5.5K,也没干1年啊,而且代码敲的也不是特熟悉,我问她 你进这个公司 人家都问你什么了 她就说问了问基础,, 我还有一个同事B女,servlet.什么javaWeb都不会,,月薪4.5K 我不敢说我多强,我想问一下哪里出了问题么.我投公司,,因为我的项目经验没有,,我确实不敢说多好,但,,人家老是问我这我问那的,感觉都是些无意义的小题,,or

求大神帮我分析分析mysql的错误日志

问题描述 求大神帮我分析分析mysql的错误日志 2016-02-17 08:42:20 5388 [Note] Plugin 'FEDERATED' is disabled. 2016-02-17 08:42:20 1828 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the o

oracle trc 文件-各位数据大神麻烦帮我分析下这个oracle的trc文件,最大游标数设置的为1000

问题描述 各位数据大神麻烦帮我分析下这个oracle的trc文件,最大游标数设置的为1000 *** 2014-01-10 09:52:31.526*********START PLSQL RUNTIME DUMP************Got internal error Exception caught in pl l run-time while running PLSQLGot ORA-1000 while running PLSQLPACKAGE BODY FPM.GET_PARAME

hibernate-用hql语句删除的时候执行dao层方法报这个错误,哪位大神帮我分析下错误原因,多谢

问题描述 用hql语句删除的时候执行dao层方法报这个错误,哪位大神帮我分析下错误原因,多谢 org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown entity: java.util.ArrayList at org.springfram

android-各位高手,帮我分析以下代码在安卓手机上运行时报错的原因!

问题描述 各位高手,帮我分析以下代码在安卓手机上运行时报错的原因! //MainActivity.java如下: ```import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebSettings.RenderPriority;

代码-linq多表连接查询速度很慢,但我在数据库查询分析器中却是秒查,请各位大侠帮我分析下

问题描述 linq多表连接查询速度很慢,但我在数据库查询分析器中却是秒查,请各位大侠帮我分析下 with temp as ( select (case when SHIFTSCHEDULEID is null then (case when TICKET_SELL_TYPE=2 then (select COMPANY_ID from TBL_YD_SHIFT where SHIFTNUMBER= (select SHIFTNUMBER from TBL_SP_TICKET where tick

tomcat-弄过安全证书的人,帮我分析下到底是什么原因?

问题描述 弄过安全证书的人,帮我分析下到底是什么原因? 我是通过地址检出已经开发好的系统,然后系统配置的环节有个过程是要在创建的server下的server.xml插入当然我也在tomcat下的conf下面配置了bmsServer.jks.听前辈说那个bmsServer.jks不用自己配置的,他的也是从别人那拿的,在他那边可以登录,并且地址栏有加密锁,然而我的却无法登录,进 不了页面.补充说明一下,我的系统启动,我那前辈可以登录我这边的,可是我把地址发给其他人,其他人的电脑却不能登录.我也自己配

java-谁帮我分析下这个原因

问题描述 谁帮我分析下这个原因 在一个类里面写了下面内容,为什么输出结果还是 l ,而不是 ss ? public static void main(String[] args) { String s = "l"; change(s); System.out.println(s); } public static void change(String ss ){ ss = "ss"; } 解决方案 change(s) 只是调用了这个方法,并没有要输出它 解决方案二: