各位高手小弟用Inet接受数据,总是数据接收不全只接受8,9k而源文件用700k这是怎么回事呢?
控件端:
intFile = FreeFile() bData() = Inet1.OpenURL(URL, icByteArray)
MsgBox "数组大小:" & UBound(bData)
Open fileName For Binary Access Write _
As #intFile
Put #intFile, , bData()
Close #intFile
servlet端:
OutputStream out=null;
InputStream in = null;
FileInputStream stream=null;
String fileID=null;
fileID=request.getParameter("edataTypeId");
if(fileID!=null && !"".equals(fileID))
{
String path = getServletContext().getRealPath("/")+ "//file//"+fileID+".jpg";
File f=new File(path);
try {
if (f != null)
{
stream = new FileInputStream(f);
out = response.getOutputStream();
byte[] b = new byte[1000];
int n;
while ((n = stream.read(b)) != -1)
{
out.write(b, 0, n);
out.flush();
}
}
}
catch (Exception e)
{
if(stream!=null)
{
stream.close();
}
if(out!=null)
{
out.close();
}
e.printStackTrace();
}
finally
{
if(stream!=null)
{
stream.close();
}
if(out!=null)
{
out.close();
}
}
}
控件端:
intFile = FreeFile() bData() = Inet1.OpenURL(URL, icByteArray)
MsgBox "数组大小:" & UBound(bData)
Open fileName For Binary Access Write _
As #intFile
Put #intFile, , bData()
Close #intFile
servlet端:
OutputStream out=null;
InputStream in = null;
FileInputStream stream=null;
String fileID=null;
fileID=request.getParameter("edataTypeId");
if(fileID!=null && !"".equals(fileID))
{
String path = getServletContext().getRealPath("/")+ "//file//"+fileID+".jpg";
File f=new File(path);
try {
if (f != null)
{
stream = new FileInputStream(f);
out = response.getOutputStream();
byte[] b = new byte[1000];
int n;
while ((n = stream.read(b)) != -1)
{
out.write(b, 0, n);
out.flush();
}
}
}
catch (Exception e)
{
if(stream!=null)
{
stream.close();
}
if(out!=null)
{
out.close();
}
e.printStackTrace();
}
finally
{
if(stream!=null)
{
stream.close();
}
if(out!=null)
{
out.close();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货