3
我有一個字節緩衝區6個字節長前四個包含IP地址最後2個包含端口,以大端符號表示。從字節緩衝區構建IP和端口
讓我使用的IP,
(apply str (interleave (map int (take 4 peer)) (repeat ".")))
撒開字節爲int安全得到的IP地址?
,並在Java中,我使用,
int port = 0;
port |= peerList[i+4] & 0xFF;
port <<= 8;
port |= peerList[i+5] & 0xFF;
這個片段以獲取端口地址。我怎樣才能將它轉換成clojure?
拉數字只是一個隨機記不相關的問題,更一般的功能:(「」交錯FOO(重複)),而不是' '你也可以做簡單的'(干涉「。」foo)「。 – kotarak 2009-12-03 08:18:03