Stream Binary data to javascript html from Java ServerSocket -
i trying stream binary data, html page using java server built using serversocket. able achieve using xmlhttprequest, observing big delay in receiving end. please share better way same avoid delay. built websocket server using java not able receive data binary in javascript.
i assume didn't specify content length of binary stream and/or not close servlet output stream. please consider following code
protected void doget(httpservletrequest request,httpservletresponse response) throws servletexception, ioexception { byte[] binarydata = createbinarycontent(); outputstream out = response.getoutputstream(); response.setcontenttype("application/octet-stream"); response.setcontentlength(binarydata.length); out.write(binarydata); out.close(); }
Comments
Post a Comment