public static void main(String[] args) throws Exception
{
ServerSocket ss=new ServerSocket(10009);
Socket s=ss.accept();
InputStream in=s.getInputStream();
FileOutputStream fos=new FileOutputStream("server.bmp");
byte[] buf=new byte[1024];
int len=0;
while((len=in.read(buf))!=-1)
{
fos.write(buf,0,len);
}
OutputStream out=s.getOutputStream();
out.write("上传成功".getBytes());
fos.close();
ss.close();
s.close();
}
在该服务端中,输出的应该是ServerSocket ss啊,为啥是s输出,还请各位师兄师姐指点。。
OutputStream out=s.getOutputStream();
out.write("上传成功".getBytes());
|