Monday, November 12, 2012

network terminal command

1. nslookup

nslookup wayne.edu
Server: 141.217.43.24
Address: 141.217.43.24#53

Non-authoritative answer:
Name: wayne.edu
Address: 141.217.1.22

网络会议 (Web meeting)

网络会议(web meeting)
1. 现有公司和软件:
  mikogo: http://www.mikogo.net.cn/download/mac-download/
2. 局域网桌面监控软件
http://www.louyue.com/lan-desktop.htm

Sunday, November 11, 2012

Get IP address, Hostname, alias, execution time

Run: ./getaddress.o www.wayne.edu
Result:
excution time: 0.553000 millseconds
offical hostname: web-prod.wayne.edu
alias: www.wayne.edu
ddress: 141.217.1.22

Getaddress.o Code:


#include <stdio.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <time.h>


int main(int argc, char **argv)
{
char *ptr, **pptr;
struct hostent *hptr;
char str[32]; // for IPv4 and IPv6
clock_t start, end; //start clock, and end clock
while (--argc) {
ptr = *++argv;
start = clock();
if ((hptr = gethostbyname(ptr)) == NULL) {
printf("gethostbyname error");
continue;
}
end = clock();
printf("excution time: %f millseconds\n",(double)1000*(end-start)/CLOCKS_PER_SEC);
printf("offical hostname: %s\n",hptr->h_name);
for (pptr=hptr->h_aliases; *pptr != NULL; pptr++) {
printf("\talias: %s\n",*pptr);
}
switch (hptr->h_addrtype) {
case AF_INET:
pptr = hptr->h_addr_list;
for (; *pptr != NULL; pptr++) {
printf("\address: %s\n",inet_ntop(hptr->h_addrtype, *pptr, str, sizeof(str)));
}
break;
default:
break;
}
}
exit(0);
}