Connection timeout??
我用Socket编程写了个小程序
public static void main(String[] args){
System.out.println( "This is client" );
byte[] buf = new byte[100];
try {
Socket s = new Socket("xxx.xxx.xxx.xxx",8899);
OutputStream os = s.getOutputStream( );
InputStream is = s.getInputStream( );
String sndStr;
String Deviceno;
String DDate;
String fileName;
Deviceno=getDevice();
DDate=getDate();
sndStr= Deviceno+" "+DDate+".J";
fileName="c:\\wsap\\data\\"+DDate+".J";
os.write( sndStr.getBytes( ) );
........
} catch(Exception ex)
{
ex.printStackTrace( );
System.out.println("err... client exit");
System.exit(0);
}
在catch之后printStackTrace()提示 ....Connection Timeout.......等一些信息,之后err退出
是在建立Socket时出错了吗???网是通的,什么原因呀???