Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: Imported DLL problem Pin
Luc Pattyn22-Apr-10 3:38
sitebuilderLuc Pattyn22-Apr-10 3:38 
AnswerRe: Imported DLL problem Pin
David Knechtges22-Apr-10 3:44
David Knechtges22-Apr-10 3:44 
QuestionThumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 2:32
ab-tools22-Apr-10 2:32 
AnswerRe: Thumbnail control for sorting images by drag & drop Pin
Eddy Vluggen22-Apr-10 5:36
professionalEddy Vluggen22-Apr-10 5:36 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 5:44
ab-tools22-Apr-10 5:44 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
Eddy Vluggen22-Apr-10 6:01
professionalEddy Vluggen22-Apr-10 6:01 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 6:11
ab-tools22-Apr-10 6:11 
QuestionRead IP address of all website currently visted Pin
makdu22-Apr-10 2:15
makdu22-Apr-10 2:15 
Hi,
I am trying to make an application which tries to read the website ip's currentely visited. I have found an example of packet sniffer in c# (http://www.codeproject.com/KB/IP/CSNetworkSniffer.aspx).
My problem is that i dont want to run the call conitnuously. So i kept the call in a timer. All works fine, but when i plugged in my wifi internet connection( in addtion to my current lan connection), i was not able to view webpage. So i modified the code such a way to montior the ip through all the port. Then i am getting
System.Net.Sockets.SocketException: An invalid argument was supplied
   at System.Net.Sockets.Socket.IOControl(Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue)
   at System.Net.Sockets.Socket.IOControl(IOControlCode ioControlCode, Byte[] optionInValue, Byte[] optionOutValue)
Here is my code

private void checkIP()
        {

            //mainSocket.Close();
            //   mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
            mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
            mainSocket.Bind(new IPEndPoint(IPAddress.Any,0));// Parse(strIP), 0));
            mainSocket.SetSocketOption(SocketOptionLevel.IP,          //Applies only to IP packets
                           SocketOptionName.HeaderIncluded, //Set the include the header
                           true);                           //option to true
            byte[] byTrue = new byte[4] { 1, 0, 0, 0 };
            byte[] byOut = new byte[4] { 1, 0, 0, 0 }; //Capture outgoing packets
          mainSocket.IOControl(IOControlCode.ReceiveAll,              //Equivalent to SIO_RCVALL constant//of Winsock 2
                   byTrue,
                   byOut);
                
            mainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnReceive), null);
            timer1Sec.Enabled = true;
        }  
 private void OnReceive(IAsyncResult ar)
        {
            try
            {
                int nReceived = mainSocket.EndReceive(ar);

                //Analyze the bytes received...

                ParseData(byteData, nReceived);

            }

            catch (Exception ex)
            {
                //   MessageBox.Show(ex.Message, "MJsniffer", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
checkIP is called from a timer. I am getting exception in mainSocket.IOControl
QuestionEnum Member Pin
DIPAK@EMSYS22-Apr-10 0:59
DIPAK@EMSYS22-Apr-10 0:59 
AnswerRe: Enum Member Pin
OriginalGriff22-Apr-10 1:02
mveOriginalGriff22-Apr-10 1:02 
GeneralRe: Enum Member Pin
DIPAK@EMSYS22-Apr-10 1:10
DIPAK@EMSYS22-Apr-10 1:10 
GeneralRe: Enum Member PinPopular
OriginalGriff22-Apr-10 1:27
mveOriginalGriff22-Apr-10 1:27 
AnswerRe: Enum Member Pin
#realJSOP22-Apr-10 1:32
mve#realJSOP22-Apr-10 1:32 
AnswerRe: Enum Member PinPopular
Pete O'Hanlon22-Apr-10 2:01
mvePete O'Hanlon22-Apr-10 2:01 
GeneralRe: Enum Member Pin
DIPAK@EMSYS22-Apr-10 2:05
DIPAK@EMSYS22-Apr-10 2:05 
GeneralRe: Enum Member Pin
PIEBALDconsult22-Apr-10 4:54
mvePIEBALDconsult22-Apr-10 4:54 
AnswerRe: Enum Member Pin
PIEBALDconsult22-Apr-10 4:57
mvePIEBALDconsult22-Apr-10 4:57 
Questionsending the value of a parameter in a form to another form smart device Pin
bacem smari22-Apr-10 0:25
bacem smari22-Apr-10 0:25 
AnswerRe: sending the value of a parameter in a form to another form smart device Pin
Sandesh M Patil22-Apr-10 2:19
Sandesh M Patil22-Apr-10 2:19 
GeneralRe: sending the value of a parameter in a form to another form smart device Pin
bacem smari22-Apr-10 3:39
bacem smari22-Apr-10 3:39 
Questionstore the results of a WMI requests in a SQLite database Pin
hafsaben22-Apr-10 0:02
hafsaben22-Apr-10 0:02 
QuestionChanging the disposition of my listView.items in csharp smart device [modified] Pin
Tunisien8621-Apr-10 23:40
Tunisien8621-Apr-10 23:40 
AnswerRe: Changing the disposition of my listView.items in csharp smart device Pin
Tunisien8622-Apr-10 5:27
Tunisien8622-Apr-10 5:27 
QuestionCreating Database and assigning DataSet shema to the Data Source Pin
pandit8421-Apr-10 23:20
pandit8421-Apr-10 23:20 
AnswerRe: Creating Database and assigning DataSet shema to the Data Source Pin
Dave Kreskowiak22-Apr-10 6:21
mveDave Kreskowiak22-Apr-10 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.