SOL9 Sample: IcmpV6Echo

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * IcmpV6Echo.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


#include <sol/WSAInitializer.h>
#include <sol\icmp\IcmpV6File.h>


void main(int argc, char* argv[])
{
  if (argc !=3) {
    printf("Usage: IcmpEcho.exe ipaddress_or_hostname message\n");
    printf("Ex.  IcmpEcho.exe ::1 \"Hello world.\"\n");

    return;
  }
  const char* ipaddr   = argv[1];
  const char* sendData = argv[2];
  
  WSAInitializer initializer;

  try {
    IcmpV6File icmpFile;
    IcmpV6EchoReply echoReply;
    IP_OPTION_INFORMATION ipOption = {255, 0, 0, 0, NULL};

    icmpFile.sendEcho2(ipaddr, sendData, &ipOption, echoReply);

    echoReply.display();

  } catch (Exception err) {
    printf("Exception: %s\n", err.getErrorMessage());
  } catch (DWORD err) {
    printf("Exception: %d\n", err);
  }

}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.