????????????socket?????java???????
???????????? ???????[ 2015/6/29 14:49:31 ] ??????????????? Java
??????????д??????????????????????selenium????????????????????tab?????????????????????????????????????????selenium?????????????????????????????????????????????????????100????80???????????????????????firefox addon?????socket???????java????????????????????firefox??tabs api????tab????????????????????????!
????????????????socket???????xpcom???
????nsiServerSocket ???????Socket????
????nsiServerSocketListener Socket?????????????????????????onSocketAccepted??onStopListening?????У?onSocketAccepted????????socket?????????onStopListening??????????????????????????????Щ????????????????
????nsiTransport ???????????Щ???????????socket?????е???????????????api???????????nsiServerSocketListener??onSocketAccepted?????ж??socket??????????????????socket?????????????д???????????
?????????????????????????д????? firefox add-on???????java??????????socket???????????????й???Щ?????ο?????
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIServerSocket
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIServerSocketListener
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITransport
????https://github.com/icsi-berkeley/fathom/blob/master/src/firefox/modules/ServerSocket.jsm ?????????github???????fathom????????????????????nsiServerSocketListener??????????????????nsiServerSocket??????
????Cc["@mozilla.org/network/server-socket;1"]
????.createInstance(Ci.nsiServerSocketListener ) ????????????????????????????????????????nsiServerSocketListener?????????????????json?????????onSocketAccepted??onStopListening?????????
??????????????????add-on main.js????????????socket????
????const {Cu??Cc??Ci} = require("chrome");
????var serverSocket = Cc["@mozilla.org/network/server-socket;1"]
????.createInstance(Ci.nsIServerSocket); //???????socket????<br>serverSocket.init(9638??false??-1); //????9638???
????????????? cfx run???????????????????е???????9638????????firefox.exe???
??????????????socket????
const nsIServerSocket = Ci.nsIServerSocket;
const nsITransport = Ci.nsITransport;
const nsIScriptableInputStream = Ci.nsIScriptableInputStream;
//????socket??????
var listener = {
onSocketAccepted : function(socket?? transport) {
//?????????????
var input = transport.openInputStream(nsITransport.OPEN_BLOCKING??0??0);
var sin = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(nsIScriptableInputStream);
sin.init(input);
var resp = "";
do {
resp = sin.read(512);
} while (resp == "");
while (sin.available() > 0)
resp += sin.read(512);
console.log(resp);
}??
onStopListening : function(socket?? status){
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11