之前有想寫一個 FQDN 轉 IP 的東西
用了 gethostbyname() 去做,不過這個 function 只適用 IPv4
輸入了 v6 相關的位址,會直接吐一個 segmentation fault 出來@@
所以改用 getaddrinfo() 跟 getnameinfo 來做相關的功能
並且可以根據需求設定只取得 IPv4 or IPv6 的位址
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
剛才寫了一個簡單的多執行序程式....記錄一下
#include <stdio.h>
#include <pthread.h>
void* thread0(void*);
void* thread1(void*);
int main(void) {
void* result;
pthread_t t0;
pthread_t t1;
pthread_create(&t0, NULL, thread0, NULL);
pthread_create(&t1, NULL, thread1, NULL);
/* wait for thread terminate */
pthread_join(t0, &result);
pthread_join(t1, &result);
return 0;
}
void* thread0(void *argu) {
int i = 0;
for (; i<5; i++) {
printf("thread0: %d\n", i);
sleep(1);
}
return NULL;
}
void* thread1(void *argu) {
int i = 0;
for (; i<10; i++) {
printf("thread1: %d\n", i);
sleep(1);
}
return NULL;
}
ps. Compile 時需要加上 -lpthread --> gcc a.c -lthread
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
1. 安裝update manager
sudo apt-get install update-manager-core
2. 檢查設定
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
2009年在 台灣NGN IPv6移轉技術入口網 上面
寫了一份簡單的IPv6 Server架設教學
發現blog還有存檔....就把它開放出來~~
Chapter 01 – Linux 與 Windows 的 IPv6 基礎
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
網卡設定
- 啟動網卡:ifconfig eth0 up
- 啟動網卡(2):ifup eth0
- 關閉網卡:ifconfig eth0 down
- 關閉網卡(2):ifdown eth0
- 設定MTU:ifconfig eth0 1500
IPv4
- 開啟forward功能:echo 1 > /proc/sys/net/ipv4/ip_forward
- 設定網卡IP:ifconfig eth0 192.168.0.1/24
- 增加網卡IP:ip -4 addr add 192.168.0.2/24 dev eth0
- 刪除網卡IP:ip -4 addr del 192.168.0.2/24 dev eth0
- 透過DHCP取得IP:dhclient eth0
- 釋放DHCP IP:dhclient -r eth0
- 清除網卡IP:ip -4 addr flush dev eth0
- 新增路由:route add -net 192.168.0.0/24 gw 192.168.0.1 dev eth0
- 刪除路由:route del -net 192.168.0.0/24 gw 192.168.0.1 dev eth0
- 新增預設路由:route add default gw 192.168.0.1 dev eth0
IPv6
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
之前有幾次曾經嘗試用 UNetbootin 將 Debian ISO 放進隨身碟
但是剛進安裝時似乎都不給面子....一直說讀不到ISO檔之類的
今天則是整個不給開
後來 google 到 這篇 Debian 的安裝手冊 .... 就想說再試一下
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
時間過得很快....轉眼間我進去成功嶺新訓了.....現在剛結束正在放結訓假XD
下週一準備到台北上班囉
也順便紀錄一下這18天在成功嶺的一些重要的事情或經歷~~
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
下面是我電腦裡面常見的好用軟體
順便整理一下讓自己重灌的時候也可以很快想起來要灌哪些東西
這些都可以免費下載
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
最後一天
這天是趕飛機大作戰!!!
13:00的飛機
就繼續看圖說故事~~~不過當時跑的超辛苦
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
第四天
這天要把握時間去買紀念品跟吃東西>"<
一樣要往外走到地鐵站.....不過這次先不進地鐵
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
這是下集.....
在附近逛完後.....就跑到熱鬧的東大門逛逛囉
一樣還是搭地鐵過去(萬年老梗)
![SDC11240.JPG SDC11240.JPG](https://imageproxy.pixnet.cc/imgproxy?url=https://pic.pimg.tw/zzzaaa12/normal_e5ac60b101dd470059947611d0b36414.jpg)
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
前一天整個非常精采.....也把自己搞得很累
從半夜兩點睡到上午10點
然後Lab突然丟出急件要趕.....害我出門的時間已經是下午快兩點了
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
經過一夜的補眠(?)後
很快的早上就到了
今天第一個目的地是到光州金大中會議中心報告傳說中的論文
跟著室友一路從旅館走到了地鐵站....搭地鐵
zzzaaa12 發表在 痞客邦 留言(0) 人氣()
由於投搞研討會的關係
我又可以出國走走了XDDD
這次來到了大家都很討厭的韓國(最夯的新聞是跆拳道跟面板 = =")
研討會的地點是在比較南部的光州
zzzaaa12 發表在 痞客邦 留言(1) 人氣()