Socket s = new Socket("192.168.1.254",10007);
FileInputStream fis = new FileInputStream(file);
OutputStream out = s.getOutputStream();
byte[] buf = new byte[1024];
int len = 0;
while((len=fis.read(buf))!=-1)
{
out.write(buf,0,len);
}
如果我向服务器上传大点的文件,比如是100M的,我可以这么写吗,还有就是在项目中是怎么写的,用TCP还是UDP,求指导
|