[問題] java.net.SocketException: Socket operation on nonsocket:
各位前輩好
小弟在使用在BufferedInputStream()時出現以下錯誤
java.net.SocketException: Socket operation on nonsocket: create
at java.net.Socket.createImpl(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
byte[] bytedata = new byte[bytedata_size];
int count;
int tmp_len =0 ;
web_contents = new String();
try { /* 讀入網頁(位元串流) */
URL pageUrl = new URL(strURL );
BufferedInputStream bis = new BufferedInputStream(pageUrl.openStream());
^
|
例外發生於這一行
使用的系統是 win7 64bits jre jdk都更新到最新版了 防火牆有關掉了
使用eclipse開發
同樣的程式碼在XP上沒有問題
不知道問題出在哪裡呢 thanks~~~~~~~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.166.96.2