Errors and exceptions in writing large binary data on sockets!!! urgent
hi
I am trying to write large binary data in the form of byte arrays on sockets.
Data is as large as 512KB(== 524288bytes) So i store the data (actually read from a file through FileInputStream ) and then write on the socket with lines like this
DataOutputStream dos =
new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
dos.write(b);
/* suppose b is the arrayreference in which data is stored. sometimes i write with that offset + len function*/
dos.flush();
dos.close();
sock.close();
but the program is not stable: sometimes the whole 512KB is read on other side and sometimes less usually 64KB.
The program is unthreaded.
There is another problem : one side(reading or writing) sometimes gives error :
java.net.SocketException: Software caused connection abort: socket write error
please reply and reply soon and give ur suggestions
thanks
hi
I am trying to write large binary data in theform
of byte arrays on sockets.
Data is as large as 512KB(== 524288bytes) So istore
the data (actually read from a file through
FileInputStream ) and then write on the socketwith
lines like this
DataOutputStream dos =
new DataOutputStream(new
BufferedOutputStream(sock.getOutputStream()));
dos.write(b);
/* suppose b is the arrayreference in which datais
stored. sometimes i write with that offset + len
function*/
dos.flush();
dos.close();
sock.close();
but the program is not stable: sometimes the whole
512KB is read on other side and sometimes less
usually 64KB.
The program is unthreaded.
There is another problem : one side(reading or
writing) sometimes gives error :
java.net.SocketException: Software caused
connection abort: socket write error
please reply and reply soon and give ursuggestions
thanksUmm how are you reading the data on the other side?
some of your code snippet might help. Your writing
code seems ok. I've written a file transfer program
in a similar fashion and have successfully testing on
different platforms (AIX, AS400, Solaris, Windows,
etc) without any problems and without needing to set
the buffer sizes with files as large as 600MB and you
said you're testing this on the loopback?
Point here is you should never need to reset any of the default TCP options to get program correctness. The options are more for optimizations and fine tuning. If indeed you need to change the options to get your program to work, then you program wont be able to scale under different load.
Similar Messages
-
Web service hangs without any errors and exceptions
hi all,
We have a ejb application web service that is binded with shedular bc to trigger for every 2 hours
and it runs for one and half hours making continous transactions with database..
In the web service a outer for loop will be iterated by fetching list of data from database. And this list will be iterated in the inner for loop.
This logic works fine for sometime, but suddenly after some random period of time without any errors and exceptions the outer for loop gets no list from database
and the inner for loop is never executed and the web service completes processing.
This i can able to see form my log files.
i dont understand why the list is not fetched from the database, is the problem with hibernate or it lost the connection with database,
either case it has to throw exception but the service is not.
otherwise does this is garbage collector issue.
Thanks in advance,
ByeWithout any code to see what's going on we'd be flying blind trying to answer this one.
-
Difference Between Errors and Exception?
I want to know what is the difference between Error and Exception?
Everything is sadly enough catchable as Throwable but
you should never catch Errors. They are an indication
that something has gone wrong in the JVM and they are
not recoverable.Although it is clear that Sun recommends against catching Errors (".. indicates
serious problems that a reasonable application should not try to catch.. etc.."), sometimes, it makes sense to catch some type of Errors.
There was that Java editor (I forgot the name) which would catch OutOfMemoryErrors when the user would try to open a file that was too large.
So instead of crashing, the application would recover from the Error, and I personnally thought that was an interesting feature. At least, a better alternative than the whole application failing. -
Hi,
Could you please tell me "What is difference between Runtime Error and Exceptions"
Thanks & Regards,
Krushna BiswalIf you would like to handle and navigate based on the exception type, this code would help you. btw I'm not familiar with portlet though.
http://sourceforge.net/projects/optionzero
http://sourceforge.net/forum/forum.php?forum_id=666191
You can declare exception type and navigation in faces-config.xml in declarative manner like Struts global exception notion.
Please let me know it's useful or not.
thanks, -
Difference between Error and Exception
Can anyone tell me the difference between error and exception
ThanzErrors and Exceptions, in a Nutshell
Errors and exceptions both inherit from Throwable, but they differ in these ways:
Exceptions
Can be checked or unchecked
Indicate an error caused by the programmer
Should be handled at the application level
Errors
Are always unchecked
Usually indicate a system error or a problem with a low-level resource
Should be handled at the system level, if possible
pretty much exceptions cause abnormal flow of the program, errors stop it, least thats my idea, it can get pretty complicated, below is a really good link for htat, also, Google it.
http://www.fawcette.com/javapro/2002_09/online/errors_jstreet_09_13_02/
really good site
-brian -
What is exact diffrence between Error and Exception
what is exact diffrence between Error and Exception....and also give me
definitions.....i would very thank full to given answer to me.Error may or may not be handled by the compiler or JVM there are many errors like Assertion error,stack over flow error out of memory error etc..
Exception is the abnormal condition and these may be handled by the compiler.There r many exceptions like clone not supported, interrupted exception,i/o exceptions...Exception can be handled by using try catch blocks. -
Difren between Error and Exception
Hi
What is the defrence between Error and Exception in the Java and Why I till now just faced with Execptions not with any Error or Error Subclasses
and thanksHi,
From an article:
Errors and exceptions both inherit from Throwable, but they differ in these ways:
Exceptions:-
Can be checked or unchecked
Indicate an error caused by the programmer
Should be handled at the application level
Errors:-
Are always unchecked
Usually indicate a system error or a problem with a low-level resource
Should be handled at the system level, if possible
-Amol -
How to upload large binary data to dB so it can be read by any app?
Hi everyone,
Short version: how do you upload binary data into a MySQL blob field in such a way that it can be read by any application?
Long version:
I've been struggling with the problem of putting files into database BLOB fields. (MySQL and Database Connectivity Toolkit).
I was initially building a query string and executing the query but was finding that certain binary characters were causing failures (end of string terminators, etc...) So, a working solution was to encode the binary string, and that worked fine, although bloated the dB a fair bit. I could decode in LabVIEW and then save the file as needed.
Now, the customer wants to be able to save the files using other apps, including the MySQL Query Browser, so an encoded file is no good.
I found using a parametrized query allows me to put the unencoded string into the dB, but it appends a 4-byte length at the front of the BLOB before it inserts it into the dB. Some apps ignore these 4-bytes (such as .pdf) but most do not.
A related thread on NI discussion forums: http://forums.ni.com/ni/board/message?boar...ssage.id=354361 has no solution, and my support ticket at NI has been ongoing without answer for a while.
Thanks,
BenThe problem is the DCT. Using ADO it is fairly easy to insert binary data into a BLOB field. I have not tried it in MySQL, but it works fine in SQL Server, Oracle, Firebird and other free/open source databases I have tried. To get you started, see this thread.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Can any one explain me the difference between an Error and an Exception.
An Error is an abnormal condition that should not occur, and a reasonable application should not try to catch.
An Exception indicates a condition that a reasonable application might want to catch and process. -
Writing large xmltype data to UTL_FILE and setting max row per file
Hey Gurus,
I am trying to create a procedure (in Oracle 9i) that writes out xml data I have created into several xml files (file would probably be to large for one xml file output...I am doing this for 270,000 rows of data), setting the max rows to 1000 rows per file. I know one would have to create a looping contsruct to do this but I am just not adept enough in PL/SQL to figure it out at the moment.
So essentially their would be some sort of loop construct and substr process that creates a file after looping through 1000 rows and then continues the count and creates a another file until all 270 xml files are created. Simple enough right...lol? Well I've tried doing this and haven't gotten anywhere. My pl/sql coding skills are too elementary I am guessing. I've only been doing this for about three months and could use the assistance of a more experienced person here.
Here are the particulars...
This is the xmltype view code that I used to create the xml data.
select XMLELEMENT("macess_exp_import_export_file",
XMLELEMENT("file_header",
XMLELEMENT("file_information")),
XMLELEMENT("items",
XMLELEMENT("documents",
(SELECT XMLAGG(XMLELEMENT("document",
XMLELEMENT("external_reference"),
XMLELEMENT("processing_instructions",
XMLELEMENT("update", name)),
XMLELEMENT("filing_instructions",
XMLELEMENT("folder_ids",
XMLELEMENT("folder",
XMLATTRIBUTES(folder_id AS "id", folder_type_id AS "folder_type_id")))),
XMLELEMENT("document_header",
XMLELEMENT("document_type",
XMLATTRIBUTES(document_type AS "id")),
XMLELEMENT("document_id", document_id),
XMLELEMENT("document_description", document_description),
XMLELEMENT("document_date",
XMLATTRIBUTES(name AS "name"), document_date),
XMLELEMENT("document_properties")),
XMLELEMENT("document_data",
XMLELEMENT("internal_file",
XMLELEMENT("document_file_path", document_file_path),
XMLELEMENT("document_extension", document_extension)
))))from macess_import_base WHERE rownum < 270000))))AS result
from macess_import_base WHERE rownum < 270000;
This is the Macess_Import_Base table that I am creating xml data from
create table MACESS_IMPORT_BASE
MACESS_EXP_IMPORT_EXPORT_FILE VARCHAR2(100),
FILE_HEADER VARCHAR2(20),
ITEMS VARCHAR2(20),
DOCUMENTS VARCHAR2(20),
DOCUMENT VARCHAR2(20),
EXTERNAL_REFERENCE VARCHAR2(20),
PROCESSING_INSTRUCTIONS VARCHAR2(20),
PATENT VARCHAR2(20),
FILING_INSTRUCTIONS VARCHAR2(20),
FOLDER_IDS VARCHAR2(20),
FOLDER_ID VARCHAR2(20),
FOLDER_TYPE_ID NUMBER(20),
DOCUMENT_HEADER VARCHAR2(20),
DOCUMENT_PROPERTIES VARCHAR2(20),
DOCUMENT_DATA VARCHAR2(20),
INTERNAL_FILE VARCHAR2(20),
NAME VARCHAR2(20),
DOCUMENT_TYPE VARCHAR2(40),
DOCUMENT_ID VARCHAR2(64),
DOCUMENT_DESCRIPTION VARCHAR2(200),
DOCUMENT_DATE VARCHAR2(100),
DOCUMENT_FILE_PATH VARCHAR2(200),
DOCUMENT_EXTENSION VARCHAR2(200)
Directory name to write output to "DIR_PATH"
DIRECTORY PATH is "\app\cdg\cov"
Regards,
ChrisI also would like to use UTL_FILE to achieve this functionality in the procedure.
-
UTL_FILE write_error when writing large binary files to unix os
I am trying to write large files to a folder in unix from a table containing a BLOB object. The procedure below is called by another procedure I have written to do this. It works in windows environment fine with files up to 360MB. When I run this exact same procedure in UNIX I get an initialization error. When I change the WB in the fopen call to W it works. I can store all the files I want up to 130MB in size. The next size larger file I have is 240MB and it fails after writing the first 1KB passing the utl_file.write_error message. If someone can help me to diagnose the problem, I would really appreciate it. i have been trying everything I can think of to get this to work.
Specifics are, the windows version is 10GR2, on unix we are running on Sun Solaris 9 using 9iR2
PROCEDURE writebin(pi_file_name IN VARCHAR2, pi_file_url IN VARCHAR2, pi_file_data IN BLOB)
IS
v_file_ref utl_file.file_type;
v_lob_size NUMBER;
v_raw_max_size constant NUMBER := 32767;
v_buffer raw(32767);
v_buffer_offset NUMBER := 1;
-- Position in stream
v_buffer_length NUMBER;
BEGIN
-- WB used in windows environment. W used in unix
v_lob_size := dbms_lob.getlength(pi_file_data);
v_file_ref := utl_file.fopen(pi_file_url, pi_file_name, 'WB', v_raw_max_size);
v_buffer_length := v_raw_max_size;
WHILE v_buffer_offset < v_lob_size
LOOP
IF v_buffer_offset + v_raw_max_size > v_lob_size THEN
v_buffer_length := v_lob_size -v_buffer_offset;
END IF;
dbms_lob.READ(pi_file_data, v_buffer_length, v_buffer_offset, v_buffer);
utl_file.put_raw(v_file_ref, v_buffer, TRUE);
v_buffer_offset := v_buffer_offset + v_buffer_length;
END LOOP;
utl_file.fclose(v_file_ref);
END writebin;
Message was edited by:
user599879check if this cample code helps -
CREATE OR REPLACE PROCEDURE prc_unload_blob_to_file IS
vlocation VARCHAR2(16) := ‘LOB_OUTPUT’;
vopen_mode VARCHAR2(16) := ‘w’;
bimax_linesize NUMBER := 32767;
v_my_vr RAW(32767);
v_start_pos NUMBER := 1;
v_output utl_file.file_type;
BEGIN
FOR cur_lob IN (SELECT vmime_type,
blob_resim,
vresim,
dbms_lob.getlength(blob_resim) len
FROM tcihaz_resim a
WHERE rownum < 3 -- for test purposes
ORDER BY a.nresim_id) LOOP
v_output := utl_file.fopen(vlocation,
cur_lob.vresim,
vopen_mode,
bimax_linesize);
dbms_output.put_line(’Column length: ‘ || to_char(cur_lob.len) || ‘ for file: ‘ ||
cur_lob.vresim);
v_start_pos := 1;
IF cur_lob.len < bimax_linesize THEN
dbms_lob.READ(cur_lob.blob_resim,
cur_lob.len,
v_start_pos,
v_my_vr);
utl_file.put_raw(v_output,
v_my_vr,
autoflush => TRUE);
dbms_output.put_line(’Finished Reading and Flushing ‘ || to_char(cur_lob.len) ||
‘ Bytes’ || ‘ for file: ‘ || cur_lob.vresim);
ELSE
dbms_lob.READ(cur_lob.blob_resim,
bimax_linesize,
v_start_pos,
v_my_vr);
utl_file.put_raw(v_output,
v_my_vr,
autoflush => TRUE);
dbms_output.put_line(’Finished Reading and Flushing ‘ || to_char(cur_lob.len) ||
‘ Bytes’ || ‘ for file: ‘ || cur_lob.vresim);
END IF;
v_start_pos := v_start_pos + bimax_linesize;
WHILE (v_start_pos < bimax_linesize) LOOP
-- loop till entire data is fetched
dbms_lob.READ(cur_lob.blob_resim,
bimax_linesize,
v_start_pos,
v_my_vr);
utl_file.put_raw(v_output,
v_my_vr,
autoflush => TRUE);
dbms_output.put_line(’Finished Reading and Flushing ‘ ||
to_char(bimax_linesize + v_start_pos - 1) || ‘ Bytes’ ||
‘ for file: ‘ || cur_lob.vresim);
v_start_pos := v_start_pos + bimax_linesize;
END LOOP;
utl_file.fclose(v_output);
dbms_output.put_line(’Finished successfully and file closed’);
END LOOP;
END prc_unload_blob_to_file;
set serveroutput on
set timing on
create or replace directory LOB_OUTPUT as ‘/export/home/oracle/tutema/’;
GRANT ALL ON DIRECTORY LOB_OUTPUT TO PUBLIC;
exec prc_unload_blob_to_file ;
Column length: 3330 for file: no_image_found.gif
Finished Reading and Flushing 3330 Bytes for file: no_image_found.gif
Finished successfully and file closed
Column length: 10223 for file: OT311.gif
Finished Reading and Flushing 10223 Bytes for file: OT311.gif
Finished successfully and file closed
PL/SQL procedure successfully completedWith 9iR2 PLSQL can write binary files using UTL_FILE put_raw function, prior to Oracle9iR2 you will need to create an external procedure with Java, C, VB or some 3gl language.
Some references -
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6379798216275
Oracle® Database PL/SQL Packages and Types Reference 10g Release 2 (10.2)
UTL_FILE - http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14095
http://psoug.org/reference/dbms_lob.html
Metalink Note:70110.1, Subject: WRITING BLOB/CLOB/BFILE CONTENTS TO A FILE USING EXTERNAL PROCEDURES -
Large binary data readout from scope
Hi ,
I would like to know how I can readout a large amount of data, 10 MSamples for a Scope trace of 10 us/div and display it on VI.
I am using direct SCPI commands instead drivers, due to the speed I need. After manually configuring the Scope, I run in the loop the following commands
:FORMatATA REAL,32
RUNSingle;*OPC?
:CHANnel1:WAVeformATA?
The queried data is in binary format and I don't know how to display it.
If you have any example program that could do it very fast, please share it.
Many thanks in advance
Y3G (...if there is LTE)What scope are you using?
As Dennis said, you need to read the manual. It will tell you what the format of the data coming back is. I've seen some just spit back 16 bit data that you then have to convert somehow. Others will give you an actual double precision floating point. And some have additional data they send with the raw data.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Lets break down the facts here: My machine is an Intel-Based iMac running Mavericks - 1TB Hitachi Hard Drive
1. Was running an initial baseline image with Time Machine when the computer froze - waited hours - nothing got better and no functions were possible (force quit, etc.)
2. Hard Reboot
3. Upon reboot, the iMac was unable to load the log-in screen. The image was a folder with a "?" on it.
4. Rebooted with option key held down and selected Macintosh HD - Boot Failed
5. Restarted and Rebooted with Command R held down
6. Ran Disk Verify and Disk Repair - returned errors round one.
7. Ran Disk Verify and Disk Repair - Returned no Errors
8. Restart - Boot failed - the "NO" symbol replaced the apple symbol
9. Reboot with Command R
10. Attempt to mount Macintosh HD
11. Mount Failed.
12. Shutdown
13. Connect Firwire to Host computer and Target Computer
14. Boot with Command T
15. TDM entered - Host Machine cannot read Target Hard Drive
16. Shutdown
17. Boot with Command S
18. Endless loop created - Multiple errors including:
- failed to open create the journal retval 0
- could not read 512 bytes for the journal header - Return 22
- Errorno 19
- hfs_mounterror return: 22
Short of springing for a software online, I have no idea what the next steps are to getting my data moved from the Macintosh HD to my external so I can just reformat and install the OS again. Any help would be greatly appreciated, this is is a serious headache and I cannot lose my data - Thats what I was backing it up for in the first place!!!!You may not have the luxury of having another Mac but you must know someone who does. You need to boot your Mac into target disk mode. This is going to be your best bet as far as saving your files. Keep in mind that everytime you mess with this computer you are further endangering your data. Also, once your Mac is booted as a target disk, it may be possible to mount it on a windoze computer just to copy your files to another drive. I used to have one here and if i still did I would try this for you but I "offed" it in favor on running windoze (Parallels) on my MBP. But, one way or another, you need to get next to another computer.
-
How to see the portal runtime errors and exception
Hi friends,
I am new to the EP. Can you plz let me know how to see the logs of the error occurs during the runtime.
I have got the following error "Error occurs during the rendering of jsp component"
But I am not able to see the logs.
can you plz tell me the exact path to see the error logs
Thanks and regards,
Kuldeep VermaHI Kuldeep
Yoiu can check the portal Logs and traces in link as the bellow.
http://your_url:portno/nwa
The JSP logs you can trace there.
Just follow the following path after loged in to NWA.
Monitoring -> Logs and Traces ->
Then in the dropdown menu select the Default Trace
Cheers
Chinmaya
Reward for helpful answers -
BSP Exception: Missing reference when converting data object ZZxx
Hi there,
I have created these new Z fields and tried to include them in a field group. These fields did appear, but they are highlighted with a red box, with the above text in the tool tip.
Does anyone know what it means??
ThanksI believe they were generated by EEWB - or could've been added manually to the CRMD_CUSTOMER_H. This error only occurs on the Currency fields...something to do with reference field but I just can't find what is wrong with this. I searched up SAP notes and found the following the closest match: -
<b>Symptom</b>
when trying to scroll down in the result list in the F4 for the Ibase the error error "BSP exception : Missing reference when converting data object amount. Correct the entry" occurs.
<b>Other terms</b>
CRMT_BSP_IBASE_TREE_NF, data object amount
<b>Reason and Prerequisites</b>
This happens due to inconsistancy in structure
<b>Solution</b>
Please follow the below steps manually.
1. Go to tx:SE11
2. Select data type "CRMT_BSP_IBASE_TREE_NF" in change mode
3. Select component AMOUNT in 'Components' tab
4. Go to "Currency/quantity fields" tab
5. Replace 'Reference table' entry from 'CRMT_BSP_IBASE_DETAIL'
to 'CRMT_BSP_IBASE_TREE_NF'
6. Save and activate
Maybe you are looking for
-
Is there a way of reordering reminders in er.... reminders?
I have loads of reminders and I would basically like to organise them into date format. Thanks.
-
Changing the behavior of a XCelsius 2008 Dashboard
Hello all, i have a problem with the coded behavior of a dashboard in xcelsius 2008. The main scene is: there is an edit-field on the surface and a lot of checkboxes The user enters an internal number into the edit and then klicks on an checkbox to s
-
I am stuck on some things and I can't find them in my book so here goes. I need to determine if a string is even or odd and then return letters from that word based on which it is. I think i need to use a boolean for the even or odd (not for sure) an
-
The Mighty ALL!!! Please tell me: " What kind of environment is better for Java programing? e.g. SomeOne Editor ( not NotePad ) with color flashes and sintax correctors".
-
For some reason, the above boxes are now greyed out when I go to Print Settings and I am getting prints that are badly distorted. Was working perfectly a few days ago and can't understand why this has suddenly happened ? Am now confused as to what s