How to listen on a socket in the modern IPv6-enabled world

Suppose that you are a fancy modern server program, and you want tolisten for both IPv4 and (if available) IPv6 connections. As it happensthis is a bit more intricate than you might expect, and it variesbetween systems.

To start with:

  • use getaddrinfo() with a NULL host, the port you want, AF_UNSPEC as the address family, and AI_PASSIVE and AI_ADDRCONFIG in the flags.

  • if the results don't contain any IPv6 sockets, you have

仍未普世

民主,由一個政治模式,變成一個政治理想,再成為了道德責任,整個過程才不過數百年。就好像從少數學者口中的政治概念,變成教科書內的一組組理論,再成為政治家高舉的口號,然後變成每一個政府的責任,今時今日即使

文學館回應文一則

(何必回應張堅庭?拼命回應羅維明。)

文學館:面向青年、面向民間 ——回應羅維明先生

讀羅維明先生的文章〈淺水灣文學館〉(10月14日信報P42),教益甚多,亦感激羅先生認同文學館是對本土文學工作者的基本肯

發現抄襲

最近我擔任一個學生徵文比賽的評判
這本來就是苦差事
但考慮到我年輕時也曾參加過這個比賽
我也經歷過利用參加比賽來肯定自己寫作能力的階段
因此我總是希望盡我所能
把有想法和有潛力的年輕人提拔出來
好好鼓勵

可是今次我

時間和金錢

很多人都會說時間就是金錢,意思大概是只要好好利用時間,就能以時間換取金錢;例如花時間去進修「增值」,便可以找到一份薪金高一點的工作,或者是提高效率,用相同的時間生產更多的東西,便可以得到更高的利潤。我

What Linux's getaddrinfo() is doing with IPv6 (on some versions)

I've previously noted that Linux's getaddrinfo() implementationdoesn't return IPv6 addresses by default if it doesn't think that yoursystem is IPv6 capable, or perhaps if your system has IPv6 disabled(this is most conveniently visible through the Python interface ). This behavior is more or less the same aswhat you'd get if you supplied the AI_ADDRCONFIG flag in the hints structure.

(To be specific, I have seen this behavior on Ubuntu 8.04


旁觀以外

拍攝別人在痛苦中的樣子,是一件不道德的事嗎?可能不是,就像在戰火之中的民眾,他們看見自己的境況在報章之中刊登出來,荒涼的家園,麻木的表情,蒼白的面孔,飢餓的身軀,茫然的眼神,無一不是痛苦的象徵,是不是

寺島忍揚威柏林影展



日本女演員 寺島忍 憑『粉紅導演』 若松孝二 所執導的《芋蟲》(Caterpillar) , 在第60屆柏林影展獲得最佳女主角銀熊獎, 成為日本電影史上第三位獲得柏林影展最佳女主角的演員. 柏林影展有史以來僅得三位日本人獲獎, 這三位演員
Continue reading...

Archdiocese of Saint Louis Redesigns Website

Archdiocese of Saint Louis' Upgraded Website

The Archdiocese of Saint Louis today upgraded its entire website to a new design and a new platform, allowing offices and agencies to more quickly and more easily communicate with the faithful in the Archdiocese (and around the world!).

I've been working on this project (with a lot of help from Palantir, a web development company in Chicago) and some local developers for the past year, and I am pleased with the result (I hope you are, too!). I've written up more


你們的機會來了

(其實我這樣不停地追著阿P來評論,係咪實在迷得佢太嚴重呢?剛寫了《介乎法國與旺角的詩意》,接下來又有〈給金鐘地鐵車廂內的人〉,實在太勁了,勁勁勁勁勁啊,係咪又要寫??咁樣係咪太著跡?)


動中帶靜 綿裡藏針