SOL9 Sample: AddressInfoList

SOL9 2.0 Samples

1 Screenshot


2 Source code

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


// SOL9
// 2010/11/28
#include <sol/WSAInitializer.h>
#include <sol/net/AddressInfoList.h>
#include <sol/Locale.h>
#include <sol/net/InetSockAddress.h>

void _tmain(int argc, TCHAR** argv)
{
  if (argc !=2) {
    _tprintf(_T("Usage:%s ipaddr_or_hostname\n"), argv[0]);
    return;
  }
  WSAInitializer initializer;
  Locale locale;
  try {
    AddressInfoList infoList;
    infoList.getAddrInfo(argv[1]);
    int num = infoList.getCount();
    _tprintf(_T("AddressInfoList.getCount(): %d\n"), num);

    _tprintf(_T("AddressInfoList.display()\n"));
    infoList.display();

  } catch (Exception& ex) {
    ex.printf();
  } catch (...) {
    _tprintf(_T("Exception\n"));
  }
}

Last modified: 2 May 2016

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