X
xjxjjx
Unregistered / Unconfirmed
GUEST, unregistred user!
我在用URL取数据时老报错:cannot access "www.delphibbs.com":80
且就是dis = new DataInputStream(serverURL.openStream()) ;
这行代码产生异常
请各位大侠指教!
源代码如下:[red][/red][black][/black]
import java.io.* ;
import java.applet.*;
import java.awt.*;
import java.lang.* ;
import java.net.* ;
public class SimpleApplet
extends Applet
{
TextArea TAContents = new TextArea("Hello World!");
Color c = Color.getColor("green",Color.green) ;
Font TAFont = new Font("TimesRoman",Font.PLAIN,16) ;
Thread getChatContents ;
public void init()
{
setLayout(new BorderLayout());
TAContents.setBackground(c) ;
TAContents.setFont(TAFont) ;
TAContents.append("/nString str") ;
add("Center", TAContents);
try
{
URL serverURL = new URL("http://www.delphibbs.com/delphibbs/askqn.asp") ;
DataInputStream dis ;
dis = new DataInputStream(serverURL.openStream()) ;
//产生异常
String readLine = dis.readLine() ;
dis.close() ;
}
catch(Exception e)
{
TAContents.append(e.getMessage()) ;
}
}
}
且就是dis = new DataInputStream(serverURL.openStream()) ;
这行代码产生异常
请各位大侠指教!
源代码如下:[red][/red][black][/black]
import java.io.* ;
import java.applet.*;
import java.awt.*;
import java.lang.* ;
import java.net.* ;
public class SimpleApplet
extends Applet
{
TextArea TAContents = new TextArea("Hello World!");
Color c = Color.getColor("green",Color.green) ;
Font TAFont = new Font("TimesRoman",Font.PLAIN,16) ;
Thread getChatContents ;
public void init()
{
setLayout(new BorderLayout());
TAContents.setBackground(c) ;
TAContents.setFont(TAFont) ;
TAContents.append("/nString str") ;
add("Center", TAContents);
try
{
URL serverURL = new URL("http://www.delphibbs.com/delphibbs/askqn.asp") ;
DataInputStream dis ;
dis = new DataInputStream(serverURL.openStream()) ;
//产生异常
String readLine = dis.readLine() ;
dis.close() ;
}
catch(Exception e)
{
TAContents.append(e.getMessage()) ;
}
}
}