示例#1
0
int main(int argc, char** argv)
{
	String hostName = SocketAddress::hostName();

	if (argc == 2)
		hostName = argv[1];
	
	print("hostName = \"%%\"\n", hostName);
	
	String canonicalName;
	Ref<SocketAddressList, Owner> list = SocketAddress::resolve(hostName, "", AF_UNSPEC, SOCK_STREAM, &canonicalName);
	
	print("canonicalName = \"%%\"\n", canonicalName);
	
	for (SocketAddressList::Index i = list->first(); list->def(i); ++i)
	{
		Ref<SocketAddress> address = list->at(i);
		bool failed;
		
		print("%% : %% : %% : %% : %% : %% : %%\n"
			, familyToString(address->family())
			, address->toString()
			, address->port()
			, socketTypeToString(address->socketType())
			, protocolToString(address->protocol())
			, address->lookupHostName(&failed)
			, address->lookupServiceName()
		);
	}
	
	return 0;
}
示例#2
0
void insertPitchAndFamily(UINT pval, CTreeCtrl * tc, HTREEITEM paf)
    {
     CString s;
     if(pval != 0)
         { /* has paf */
          int id;
          CString t;
          id = pval;

          t.LoadString(IDS_PITCH);
          HTREEITEM pitch = tc->InsertItem(t, paf);

          s = pitchToString(id, TMPF_FIXED_PITCH, IDS_TMPF_FIXED_PITCH);
          if(!s.IsEmpty())                                          // REQ #037
             tc->InsertItem(s, pitch);

          s = pitchToString(id, TMPF_VECTOR, IDS_TMPF_VECTOR);
          if(!s.IsEmpty())                                          // REQ #037
             tc->InsertItem(s, pitch);

          s = pitchToString(id, TMPF_TRUETYPE, IDS_TMPF_TRUETYPE);
          if(!s.IsEmpty())                                          // REQ #037
             tc->InsertItem(s, pitch);

          s = pitchToString(id, TMPF_DEVICE, IDS_TMPF_DEVICE);
          if(!s.IsEmpty())                                          // REQ #037
             tc->InsertItem(s, pitch);

          if( (id & (TMPF_VECTOR | TMPF_TRUETYPE)) == 0)
             { /* raster */
              CString t;
              t.LoadString(IDS_TMPF_RASTER);
              s.Format(_T("%02x %s"), 0, t);
              tc->InsertItem(s, pitch);
             } /* raster */

          s = familyToString(pval);
          if(!s.IsEmpty())                                          // REQ #037
             tc->InsertItem(s, paf);

         } /* has paf */
     
    }