#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Smile Ping problem with delphi XE5


    hi to all my friends
    I write below codes in delphi xe5.
    when destination address is not available, i have no problem and program shows me False message, but when the address is available, i receive "Socket Error # 10040 Message Too Long" message.
    I change parameters of IdIcmpClient1, such as PacketSize, Port and so on, but my problem is here.
    please guide me.

    Code:
    with IdIcmpClient1 do
      begin
        ReceiveTimeout := 1000;
        Host := '4.2.2.4';
        Ping;
        Sleep(2000);
        if ReplyStatus.ReplyStatusType = rsEcho then
          ShowMessage('True')
        else
          ShowMessage('False');
      end;
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Smile


    Originally Posted by asgarkz
    hi to all my friends
    I write below codes in delphi xe5.
    when destination address is not available, i have no problem and program shows me False message, but when the address is available, i receive "Socket Error # 10040 Message Too Long" message.
    I change parameters of IdIcmpClient1, such as PacketSize, Port and so on, but my problem is here.
    please guide me.

    Code:
    with IdIcmpClient1 do
      begin
        ReceiveTimeout := 1000;
        Host := '4.2.2.4';
        Ping;
        Sleep(2000);
        if ReplyStatus.ReplyStatusType = rsEcho then
          ShowMessage('True')
        else
          ShowMessage('False');
      end;
    I found the solution for this problem from StackOverFlow.com

    Code:
    with IdIcmpClient1 do
      begin
        ReceiveTimeout := 1000;
        Host := '4.2.2.4';
        ABuffer := Host + StringOfChar(' ', 255);
        Ping(ABuffer);
        if ReplyStatus.ReplyStatusType = rsEcho then
          ShowMessage('True')
        else
          ShowMessage('False');
      end;
    [/QUOTE]

IMN logo majestic logo threadwatch logo seochat tools logo