Click here to Skip to main content
15,913,570 members
Home / Discussions / C#
   

C#

 
GeneralRe: Search files.. Pin
Vasudevan Deepak Kumar14-Aug-05 1:54
Vasudevan Deepak Kumar14-Aug-05 1:54 
GeneralRe: Search files.. Pin
nc3b14-Aug-05 5:52
nc3b14-Aug-05 5:52 
GeneralNumericUpDown Control Pin
Yigal Agam13-Aug-05 9:51
Yigal Agam13-Aug-05 9:51 
GeneralRe: NumericUpDown Control Pin
Daniel Grunwald13-Aug-05 10:48
Daniel Grunwald13-Aug-05 10:48 
GeneralXML Deserialisation and Default Values Pin
MrEyes13-Aug-05 9:48
MrEyes13-Aug-05 9:48 
Generaliphlpapi.dll and sendarp Pin
Genbox13-Aug-05 8:24
Genbox13-Aug-05 8:24 
GeneralRe: iphlpapi.dll and sendarp Pin
Bojan Rajkovic13-Aug-05 19:07
Bojan Rajkovic13-Aug-05 19:07 
GeneralRe: iphlpapi.dll and sendarp Pin
Genbox13-Aug-05 23:58
Genbox13-Aug-05 23:58 
Thanks for the fast reply.

I think i have figured the SendARP() out now, but i still can't give it the IP destination in integer.

i tried with the code you provieded me, like this:

<br />
public partial class _Default : System.Web.UI.Page <br />
{<br />
    [DllImport("iphlpapi.dll", ExactSpelling = true)]<br />
    public static extern int SendARP(int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen);<br />
<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
<br />
    }<br />
    protected void Button1_Click(object sender, EventArgs e)<br />
    {<br />
        byte[] outputData = new byte[6];<br />
        int dataLength = outputData.Length;<br />
        SendARP(StringIPToLong("192.168.1.101"), StringIPToLong("127.0.0.1"), outputData, ref dataLength);<br />
        Label1.Text = "MAC:" + BitConverter.ToString(outputData, 0, 6);<br />
    }<br />
    <br />
    public static int StringIPToInt(string IPString)<br />
    {<br />
        string[] _splitString = IPString.Split(new char[] { '.' });<br />
        int _retVal = 0;<br />
        if (_splitString.Length < 4)<br />
            throw new ArgumentException("Please pass in a valid IP in dotted-quad notation!", "IPString");<br />
        else<br />
        {<br />
            _retVal += (int)(int.Parse(_splitString[3]) * Math.Pow(256, 0));<br />
            _retVal += (int)(int.Parse(_splitString[2]) * Math.Pow(256, 1));<br />
            _retVal += (int)(int.Parse(_splitString[1]) * Math.Pow(256, 2));<br />
            _retVal += (int)(int.Parse(_splitString[0]) * Math.Pow(256, 3));<br />
        }<br />
        _retVal = (int)(((_retVal & 0x000000ff) << 24) +<br />
            ((_retVal & 0x0000ff00) << 8) +<br />
            ((_retVal & 0x00ff0000) >> 8) +<br />
            ((_retVal & 0xff000000) >> 24));<br />
        return _retVal;<br />
    }<br />


The error i get is:

Default.aspx.cs(24): error CS0103: The name
'StringIPToLong' does not exist in the current context

That sound like it can't find the StingIPToLong function in the current codeblock, but the function is declared "public" so i thought that it worked in all codeblocks.
GeneralRe: iphlpapi.dll and sendarp Pin
Rob Graham14-Aug-05 1:27
Rob Graham14-Aug-05 1:27 
GeneralRe: iphlpapi.dll and sendarp Pin
Anonymous14-Aug-05 2:38
Anonymous14-Aug-05 2:38 
GeneralRe: iphlpapi.dll and sendarp Pin
Bojan Rajkovic14-Aug-05 11:49
Bojan Rajkovic14-Aug-05 11:49 
GeneralRe: iphlpapi.dll and sendarp Pin
mohsenbz12-Feb-12 20:05
mohsenbz12-Feb-12 20:05 
GeneralZoming problem in c# Pin
wasife13-Aug-05 7:30
wasife13-Aug-05 7:30 
GeneralRe: Zoming problem in c# Pin
Guffa13-Aug-05 7:35
Guffa13-Aug-05 7:35 
GeneralDistribute my software to other computers Pin
Ming Luo13-Aug-05 1:00
Ming Luo13-Aug-05 1:00 
GeneralRe: Distribute my software to other computers Pin
User 665813-Aug-05 1:39
User 665813-Aug-05 1:39 
GeneralRe: Distribute my software to other computers Pin
Ming Luo13-Aug-05 5:22
Ming Luo13-Aug-05 5:22 
GeneralRe: Distribute my software to other computers Pin
User 665813-Aug-05 7:50
User 665813-Aug-05 7:50 
Generalproblem with asynchronous server Pin
bahith13-Aug-05 0:40
bahith13-Aug-05 0:40 
GeneralRe: problem with asynchronous server Pin
Vasudevan Deepak Kumar14-Aug-05 1:55
Vasudevan Deepak Kumar14-Aug-05 1:55 
GeneralRe: problem with asynchronous server Pin
S. Senthil Kumar14-Aug-05 3:31
S. Senthil Kumar14-Aug-05 3:31 
GeneralDatetimePicker in a datagrid Pin
deep712-Aug-05 21:36
deep712-Aug-05 21:36 
GeneralUnmanaged dll access from c# passing paramaters by reference Pin
steveski7412-Aug-05 21:13
steveski7412-Aug-05 21:13 
Generalwrapping Dlls into .exe Pin
allenmpcx12-Aug-05 19:08
allenmpcx12-Aug-05 19:08 
GeneralRe: wrapping Dlls into .exe Pin
S. Senthil Kumar12-Aug-05 19:53
S. Senthil Kumar12-Aug-05 19:53 

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.