Streaming Binary Data
Hi,
I would like to send plain old binary data using RTP. How can I use the JMF to send binary data without binding it to a codec or media type?
Thanks,
sam8680 wrote:
I would like to send plain old binary data using RTP. How can I use the JMF to send binary data without binding it to a codec or media type?Is there a particular reason you don't want to use a normal UDP or IP socket for plain old binary data?
Similar Messages
-
Exception writing binary data to the output stream to client -Broken pipe
Hi,
I am trying to use the drag & drop feature using Contributor mode of Webcenter sites. Single Image Page Attribute is working properly where as Multiple Image Page Attribute throws the following error:
[ERROR] [.kernel.Default (self-tuning)'] [logging.cs.satellite.request] Exception writing binary data to the output stream to client 10.191.117.106
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at weblogic.servlet.internal.ChunkOutput.writeChunkTransfer(ChunkOutput.java:568)
at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:539)
at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:427)
at weblogic.servlet.internal.ChunkOutput$2.checkForFlush(ChunkOutput.java:648)
at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:333)
at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:148)
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:148)
at COM.FutureTense.Servlet.ServletRequest$OutputOutputStream.write(ServletRequest.java:80)
at COM.FutureTense.Servlet.ServletRequest.write(ServletRequest.java:1633)
at com.openmarket.Satellite.RequestContext.write(RequestContext.java:1123)
at com.openmarket.Satellite.BytePiece.stream(DataPiece.java:253)
at com.openmarket.Satellite.CacheObjectImpl.stream(CacheObjectImpl.java:651)
at com.openmarket.Satellite.Http11Responder.respondForWrapper(Http11Responder.java:142)
at com.openmarket.Satellite.WrapperAwareResponder.respond(WrapperAwareResponder.java:36)
at com.openmarket.Satellite.SatelliteServer.execute(SatelliteServer.java:85)
at com.openmarket.Satellite.servlet.BaseServlet.doGet(BaseServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.fatwire.wem.sso.cas.filter.CASFilter.doFilter(CASFilter.java:557)
at com.fatwire.wem.sso.SSOFilter.doFilter(SSOFilter.java:51)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Thanks
KarthiKThank u very much,
FileOutputStream opGif = new FileOutputStream(destFile, false);
I have changed above line with the following line:
PrintWriter opGif = new PrintWriter ( new FileWriter(destFile, false));
and now this code is working very fine.
Thanks once again... -
Conversion of a binary data stream to decimal numbers
Hi
I am having great difficult working out how to convert my binary data stream to decimal numbers.
The data I am reading back is in the format of a binary string, starting with the Most Significant Bit (MSB) of the first word, then the corresponding Least Significant Bit (LSB), where a word is two bytes long. A carriage return indicates message termination. The return message starts with ‘bin,’ followed by the number of bytes requested. No delimiters are used to separate the data, but a carriage return is appended onto the end of the data.
bin,<first word msb><first word lsb>...<last word lsb><CR>
e.g. bin,$ro¬z1;@*...etc
Does anybody know of any examaple vi that can help me convert this data from binary to decimal numbers?
Many Thanks
AshHi Ashley,
after getting the string you can strip the first 4 characters. After this try a typecasting to array of U16. If the numbers are not correct, you can add a swap bytes operation to the resulting array.
Message Edited by GerdW on 09-13-2006 02:46 PM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
Convert.png 2 KB -
Data plug-in for binary data with byte streams of variable length
Hi there,
I would like to write a data plug-in to read binary data from file and I'm using DIAdem 10.1.
Each data set in my file consists of binary data with a fixed structure (readable by using direct access channels) and of a byte stream of variable length. The variable length of each byte stream is coded in the fixed data part.
Can anyone tell me how my data plug-in must look like to read such kind of data files?
Many thanks in advance!
Kind regards,
StefanHi Brad,
thank you for the very quick response!
I forgot to mention, that the data in the byte stream can actually be ignored, it is no data to be evaluated in DIAdem (it is picture data and the picture size varies from data set to data set).
So basically, of each data set I would like to read the fixed-structure data (which is the first part of the data set) and discard the variable byte stream (last part of the data set).
Here is a logical (example) layout of my binary data file:
| fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXX (byte stream)
| fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXX (byte stream)
| fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXXXXXXXXX (byte stream)
What I would like to show in DIAdem is only fixedSize-Value1 and fixedSize-Value2.
´
If I understood right, would it be possible to set the BlockLength of each data set by assigning Block.BlockLength = fixedSize-Value3 and to use Direct Access Channels for reading fixedSize-Value1 and fixedSize-Value2 ?
Thank you!
Kind regards,
Stefan -
STREAMING 을 이용해서 BLOB 에 BINARY DATA 를 저장하는 SAMPLE
제품 : JDBC
작성날짜 : 2003-08-07
STREAMING 을 이용해서 BLOB 에 BINARY DATA 를 저장하는 SAMPLE
============================================================
PURPOSE
STREAMING 을 이용해서 BLOB COLUMN 에 BINARY DATA 를 저장하는
방법을 SAMPLE 을 통해 알아 봅니다.
Explanation
다음 예제는 먼저 blob column 이 들어 있는
MEDIA_STORE 라는 table 을 만들고 그 table 안에
e:\temp\mytest.avi 파일을 insert 하는 내용입니다.
Example
다음을 실행하기 전에 다음명령으로 예제 TABLE 을 생성해야
합니다.
CREATE TABLE MEDIA_STORE ( MNAME VARCHAR2(25),
MTYPE VARCHAR2(15),
MDATA BLOB );
OracleBLOB.java 소스
import java.io.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
public class OracleBLOB extends Object
Connection conn;
public OracleBLOB()
private void openSession() throws SQLException, Exception
try {
//Register the Oracle JDBC Driver.
Class.forName("oracle.jdbc.driver.OracleDriver");
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//Open a session.
conn = DriverManager.getConnection("jdbc:oracle:thin:@krint-5.kr.oracle.com:1525:ora920","scott","tiger");
} catch(SQLException e) {
e.printStackTrace();
private void insertBLOB() throws SQLException, Exception
BLOB blob;
File binFile;
FileInputStream instream;
OutputStream outstream;
try {
//Set AutoCommit to OFF - required by BLOB locking mechanism.
conn.setAutoCommit(false);
//Create a statement.
Statement stmt = conn.createStatement ();
//Insert an empty BLOB locator.
stmt.execute("INSERT INTO MEDIA_STORE VALUES('THX','DVD-VOB',empty_blob())");
//Execute the query and lock the BLOB row.
ResultSet rset = stmt.executeQuery ("SELECT MDATA FROM MEDIA_STORE WHERE MNAME='THX' FOR UPDATE");
rset.next();
//Get the BLOB locator.
blob = ((OracleResultSet)rset).getBLOB(1);
//Get the large binary media file.
binFile = new File("e:\\temp\\mytest.avi");
instream = new FileInputStream(binFile);
//Insert to the BLOB from an output stream.
outstream = blob.getBinaryOutputStream();
//Read the input stream and write the output stream by chunks.
byte[] chunk = new byte[blob.getChunkSize()];
int i=-1;
System.out.println("Loading");
while((i = instream.read(chunk))!=-1)
{ outstream.write(chunk,0,i); System.out.print('.'); }
//Close the input and output stream.
instream.close();
outstream.close();
//Close the statement.
stmt.close();
} catch(SQLException e) {
e.printStackTrace();
private void closeSession() throws SQLException, Exception
try {
//Close the session.
conn.close();
} catch(SQLException e) {
e.printStackTrace();
public static void main(String[] args) throws SQLException, Exception
OracleBLOB app = new OracleBLOB();
app.openSession();
app.insertBLOB();
app.closeSession();
실행결과 :
E:\temp>java OracleBLOB
Loading
E:\temp>
Reference Documents
Note:95816.1 -
PbyFwData - Pointer to the firmware binary data stream.
Hello,
I used labview to call a dll, but it have one parameter "pbyFwData" which Pointer to the firmware binary data stream.i don't understand what mean is "Pointer to the firmware binary data stream".I try to make this parameter point to the firmware path, but the program can't be run.the below is the .dll source code. who can tell you how to pass the value to the parameter "pbyFwData" by labview?
// Purpose: Public function to download the Flash Preloader.
// Parameter:
// hZvDev - Handle of the Zeevo Device.
// pbyFwData - Pointer to the firmware binary data stream.
// uFwLen - The length of the preloader.
// Return value: SUCCESS if successful; Otherwise, the error code.
ZEEVOPTU_API int ZV4301_SendPreLoader(HANDLE hZvDev,
unsigned char *pbyFwData,
unsigned long uFwLen)
ZV4301 *pZvDev;
COMM_DESC *pPort;
int nResult, nTmOut;
const unsigned long uBlkSize = 0x400;
unsigned long uDummy, uCRC;
unsigned char byDataBuf[32];
unsigned char byData;
if (!Validate(hZvDev))
return ERR_BAD_HANDLE;
pZvDev = (ZV4301 *)hZvDev;
pPort = pZvDev->PortDesc;
// Setup the Address and Length
memset(byDataBuf, 0, sizeof(byDataBuf));
LD_LoaderProgramAddr(byDataBuf) = LD_ZV4301_LOADER_ADDR;
LD_LoaderProgramLengh(byDataBuf) = uFwLen;
// Calculate the Header CRC
uCRC= UT_CRCBuffer(byDataBuf+4, 8);
LD_LoaderProgramHdrCRC(byDataBuf) = uCRC;
// Calculate the Data CRC
uCRC = CalculateCRC(pbyFwData, uFwLen);
LD_LoaderProgramDataCRC(byDataBuf) = uCRC;
// Detect target reset
nResult = IsChipPwrOnReset(pZvDev, 10000);
if (nResult != SUCCESS)
return nResult;
// send out header first
nResult = WriteSerial(pZvDev, byDataBuf, LD_LOADER_PRGM_HDR_LEN);
if (nResult != SUCCESS)
return nResult;
while (uFwLen > 0)
{ // sending the preloader file
if (uFwLen >= uBlkSize)
nResult = WriteSerial(pZvDev, pbyFwData, uBlkSize);
pbyFwData += uBlkSize;
uFwLen -= uBlkSize;
else
nResult = WriteSerial(pZvDev, pbyFwData, uFwLen);
uFwLen = 0;
if (nResult != SUCCESS)
return nResult;
nTmOut = 100;
while (nTmOut > 0)
{ // getting the respond 0xAA
if (GetByte(pZvDev, &byData))
if (byData == 0xAA)
break;
Sleep(10);
nTmOut -= 10;
if (nTmOut == 0)
return ERR_DOWNLD_PRELDR;
nResult = SetCommBaud(pZvDev, FLOWCTRL_DIS, pPort->uBaud, &uDummy);
return nResult;Hi,
The pointer is a U32 that points to a memory location where the data is. It is not clear from the prototype whether the pointer points to data that is feeded to the dll, or returned from the dll.
If data is feeded, wire an array to this parameter, and set uFwLen to it's length.
If data is returned, you need to use some other api calls to get the data from memory...
Regards,
Wiebe.
"Jimmy168" <[email protected]> wrote in message news:[email protected]...
Hello,I used labview to call a dll, but it have one parameter "pbyFwData" which Pointer to the firmware binary data stream.i don't understand what mean is "Pointer to the firmware binary data stream".I try to make this parameter point to the firmware path, but the program can't be run.the below is the .dll source code. who can tell you how to pass the value to the parameter "pbyFwData" by labview?
//------------------------------------------------------------------------------// Purpose: Public function to download the Flash Preloader.// Parameter:// hZvDev - Handle of the Zeevo Device.// pbyFwData - Pointer to the firmware binary data stream.// uFwLen - The length of the preloader.// Return value: SUCCESS if successful; Otherwise, the error code.//------------------------------------------------------------------------------ZEEVOPTU_API int ZV4301_SendPreLoader(HANDLE hZvDev, unsigned char *pbyFwData, unsigned long uFwLen){ ZV4301 *pZvDev; COMM_DESC *pPort; int nResult, nTmOut; const unsigned long uBlkSize = 0x400; unsigned long uDummy, uCRC; unsigned char byDataBuf[32]; unsigned char byData;
if (!Validate(hZvDev)) return ERR_BAD_HANDLE; pZvDev = (ZV4301 *)hZvDev; pPort = pZvDev->PortDesc;
// Setup the Address and Length memset(byDataBuf, 0, sizeof(byDataBuf)); LD_LoaderProgramAddr(byDataBuf) = LD_ZV4301_LOADER_ADDR; LD_LoaderProgramLengh(byDataBuf) = uFwLen; // Calculate the Header CRC uCRC= UT_CRCBuffer(byDataBuf+4, 8); LD_LoaderProgramHdrCRC(byDataBuf) = uCRC; // Calculate the Data CRC uCRC = CalculateCRC(pbyFwData, uFwLen); LD_LoaderProgramDataCRC(byDataBuf) = uCRC; // Detect target reset nResult = IsChipPwrOnReset(pZvDev, 10000); if (nResult != SUCCESS) return nResult; // send out header first nResult = WriteSerial(pZvDev, byDataBuf, LD_LOADER_PRGM_HDR_LEN); if (nResult != SUCCESS) return nResult;
while (uFwLen > 0) { // sending the preloader file if (uFwLen >= uBlkSize) { nResult = WriteSerial(pZvDev, pbyFwData, uBlkSize); pbyFwData += uBlkSize; uFwLen -= uBlkSize; } else { nResult = WriteSerial(pZvDev, pb -
Revision: 14486
Revision: 14486
Author: [email protected]
Date: 2010-03-01 14:27:41 -0800 (Mon, 01 Mar 2010)
Log Message:
Add stream metadata support by extracting the actual metadata object from the binary data stream.
Fix bug 466
Modified Paths:
osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/ManifestParser.as
osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/Media.as
osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/HTTPStreamingUtils.as
osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/f4f/HTTPStreamingF4FIndexHandler.as
osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/f4f/HTTPStreamingF4FStreamInfo.assame problem, data not replicated.
its captured,propagated from source,but not applied.
also no apply errors in DBA_APPLY_ERROR. Looks like the problem is that LCRs propagated from source db do not reach target queue.can i get any help on this?
queried results are as under:
1.at source(capture process)
Capture Session Total
Process Session Serial Redo Entries LCRs
Number ID Number State Scanned Enqueued
CP01 16 7 CAPTURING CHANGES 1010143 72
2. data propagated from source
Total Time Executing
in Seconds Total Events Propagated Total Bytes Propagated
7 13 6731
3. Apply at target(nothing is applied)
Coordinator Session Total Total Total
Process Session Serial Trans Trans Apply
Name ID Number State Received Applied Errors
A001 154 33 APPLYING 0 0 0
4. At target:(nothing in buffer)
Total Captured LCRs
Queue Owner Queue Name LCRs in Memory Spilled LCRs in Buffered Queue
STRMADMIN STREAMS_QUEUE 0 0 0 -
Convert Binary Data to string in MsSQL
Hello,
I am running a query for MSSQL database to get some file content which is stored in Binary data format in the database.
I want to copy that file which is in the binary data format to a file in the text format.
How can I do this?
Regards,
SravanthiThis is the expected result in the file that stores the data.
ResultElement
WshOutputTest
Errors/Failures
1 / -
Incident
Error: some unexpected result
function main()
some additional info; eg. stacktrace
Incident
Warning: some warning message
function main()
some additional info; eg. stacktrace
But I am getting the following stored in my file:::
PK FSH;
output.xmlíT»NÃ@8¥
*Æ)xH) R[ñÅ9AìȾðøy`nÏs1nBY>_vvfÊÏw>±ÄÞ¡Q¢AWà§8ãWÉ1£=%#ôÜá^ü5BC ½+¬©iqËSSßñ-u&Yù:»ÓÒ²À#+9¯A©øDÔ*ù|¯y®E1fôìåNËëì»ü~¼ÕK{ ·0ßKÖ2ÞbÞ*
*©\fW<gRyJk¹Ñ'Ã6?T¦ÍOÈÐÿx[³cwñCÌRÛ0^y¼éù}.y»|ýF(ÚéÐ%fÓÕu]¿Ùõ§§WNdÿLíy)ûq÷¨'ÌáßRnZ"·ªaÃ:ÎßóûÏl?ÍQbm=wk¸ûÙî>[ôÿy_PKÙõ¡¬N PK FSH;Ùõ¡¬N *
*output.xmlPK 8 *
I tried getting the Binary Stream with UTF-8 encoding style and no encoding style too but it didnt work.
Thanks,
Sravanthi. -
Zip binary data and save zip file to disk at bsp
Hi,
I try to compress (zip) binary data (for example a picture) and then give it to a html page. I use the cl_abap_gzip=>compress_binary method and it seems to work. But when I save the zip-file to harddisk over the popup at the html - page, the file could not be opened. WinZip says that it is an unvalid archive.
Can anybody help me?
Here my example coding at the OnInitialization Event of the business server page:
* event handler for data retrieval
* local variables
DATA: xsourcefile TYPE xstring.
DATA: xzippedfile TYPE xstring.
DATA: source_file_mime_type TYPE string.
DATA: xzippedcontentlength TYPE i, xzippedcontentlengthstring TYPE
string.
* References
DATA: o_mime_api TYPE REF TO if_mr_api.
* processing
* +++ Read File from MIME-Repository (binary) +++
CALL METHOD cl_mime_repository_api=>if_mr_api~get_api
RECEIVING
r_mr_api = o_mime_api.
CALL METHOD o_mime_api->get
EXPORTING
i_url = 'SAP/ZGSD_SD_ADIS/test.gif'
* I_CHECK_AUTHORITY = 'X'
IMPORTING
* E_IS_FOLDER =
e_content = xsourcefile
e_mime_type = source_file_mime_type
* E_LOIO =
* CHANGING
* C_LANGUAGE =
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* +++ create ZIP-File +++
TRY.
CALL METHOD cl_abap_gzip=>compress_binary
EXPORTING
raw_in = xsourcefile
* RAW_IN_LEN = -1
* COMPRESS_LEVEL = 6
IMPORTING
gzip_out = xzippedfile
gzip_out_len = xzippedcontentlength.
* ... Länge Casten !
xzippedcontentlengthstring = xzippedcontentlength.
* ... Errorhandling
CATCH cx_parameter_invalid_range . " Error-Handling
CATCH cx_sy_buffer_overflow . " Error-Handling
CATCH cx_sy_compression_error . " Error-Handling
ENDTRY.
* +++ Put ZIP-File in Response +++
response->set_data( xzippedfile ).
response->set_header_field( name = if_http_header_fields=>content_type
value = 'application/octet-stream' ).
response->set_header_field( name =
if_http_header_fields=>content_length
value = xzippedcontentlengthstring ).
response->set_header_field( name = 'Content-Disposition'
value = 'inline;filename=test.zip' ).
navigation->response_complete( ).
Thanks Timo
PS: I posted this question also at ABAP Forum.Hi,
First you need to define your ext prog in SM69.
It is simple though, specify:
Command name: ZZIPBIN
OS: (your os)
System command: /yourpath/zzipbin
Extra params allowed: checked
Then you need to code this:
data: table TYPE zeu_t_btcxpm.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZZIPBIN'
additional_parameters = param
operatingsystem = sy-opsys
terminationwait = 'X'
TABLES
exec_protocol = table
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
See also http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a8023505211d189550000e829fbbd/frameset.htm
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d! -
Writing binary data to ASP file from applet through URLConnection
Hi Everybody,
I am facing a proble with HttpURLConnection.I want to write some binary data from applet to an ASP file.The other end ASP file read this binary data and process , Here problem is I have opened URLConnection to the page and Created OutputStream and writing byte by Write() method But other end we are not getting bytes...we are not getting error too at java side..can any body help me..do we need to set any property to URLConnection...here I am giving sample code...
OutputStream os;
URL uConnect2;
HttpURLConnection hucConnect2;
uConnect2= new URL("http://webserver/vnc/sendtoserver.asp?"); hucConnect2=(HttpURLConnection)uConnect2.openConnection();
hucConnect2.setDoOutput(true);
hucConnect2.setRequestMethod("POST")
os=new DataOutputStream(hucConnect2.getOutputStream());
os.writeBytes("Hello");
Thanks in Advance
MadhavDo you remember to flush() and close() the stream?
-
How to output binary data to VISA
i am interfacing labview with pic microcontroller through serial port using VISA. it is a stream of digital data which is being tranmitted ,stored in microcontroller and then retransmiited by microcontroller to other device...problem is when that data is converted to string to be given to VISA it makes 16bytes out of 16bits...for example if data was "11110000" (1byte) after converted to string it becomes 8 bytes and my microcontroller thibk that 8 bytes are coming................ please kindly tell me how to transmit binary data over serial port so that bit remains a bit dont become byte............................ data is 99bytes but after passing through VISA it become "99x16"bytes........ please help me
regards
umairThe attached example in 8.0 converts a U16 into two U8, builds an array and with the Byte Array to String, converts to the hex string 8000 (two bytes). Note that the string indicator is configured for Hex Display (right click option).
Now, when you say you want to see '1000001 on the hyperterminal of other PC', you are contradicting yourself. Hyperterminal cannot be set for binary display so if you want to see '10000001' in Hyperterminal, then you need 8 bytes (one for each ASCII character).
I hope I have made myself clear.
Attachments:
U16 to Hex String.vi 8 KB -
Adapter development: binary data and adapter specific properties?
Hi,
We have succesfully developed our own SFTP adapter based on the J2SSH Maverick library (http://www.sshtools.com/showMaverick.do) and the sample file adapter that comes with XI.
There are 2 features we would like to implement as well, but lack the necessary documentation and sample code.
<b>1st Binary data</b>
We do not succeed in transporting binary data via our SFTP adapter (both text and xml go fine). While debugging, we see that the binary data are correctly picked up, but the actual payload appearing in message monitoring is much larger. When we write the message to a file again, the data have changed (size has e.g. increased importantly from 127180 bytes to 218198 bytes). According to the sample adapter code, the contenttype "application/octet-stream" should be specified. But the standard XI file adapter itself seems to specify "application/octet-stream".
<b>2nd Adapter specific properties (DynamicConfiguration)</b>
How can we set adapter specific properties in our own adapter code? Where are the Java docs of the API? Is this somewhere documented?
If you would have more information (or pointers), please post it as a response to this message.
Kind regards, Guy Crets
<b>Code snippet:</b>
XIMessageFactoryImpl mf = new XIMessageFactoryImpl();
Message msg = mf.createMessageRecord(fromParty, toParty, fromService, toService, action, actionNS);
msg.setDeliverySemantics(DeliverySemantics.ExactlyOnce);
// In case of XML documents it is not necessary to set the contentType or encoding
// But: take care that the encoding definiton in the XML document corresponds to the encoding used
if (msgText.indexOf("<?xml") != -1)
// Check whether the payload is a XML document. If not, treat it as binary to demonstrate how
// binary main documents work
// First create a XML Payload
XMLPayload xp = null;
xp = msg.createXMLPayload();
xp.setText(msgText);
xp.setName("MainDocument");
xp.setDescription("XI AF Sample Adapter Input: XML document as MainDocument");
msg.setDocument(xp);
// In case of binary documents use the Payload super class methods to fill the XMLPayload object
else
// Check whether the payload is a XML document. If not, treat it as binary to demonstrate how
// binary main documents work
// First create a XML Payload
XMLPayload xp = null;
xp = msg.createXMLPayload();
//xp.setContentType("application/octet-stream");
xp.setContentType("application/xml");
xp.setName("MainDocument");
xp.setDescription("XI AF Sample Adapter Input: Binary as MainDocument");
xp.setContent(msgData);
// Finally set the main document in the message
msg.setDocument(xp);
TRACE.debugT(SIGNATURE, XIAdapterCategories.CONNECT_AF, "Message object created and filled.");
ModuleData md = new ModuleData();
md.setPrincipalData(msg);Hello Moorthy,
I know this part of the documentation.
So I set the indicator within the communication channel.
Now, I have to fill the dynamic configuration during my mapping. My code looks like following:
DynamicConfigurationKey keyURL = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/HTTP", <b>XXXXX</b>);
// access dynamic configuration
DynamicConfiguration conf = (DynamicConfiguration) param.get (StreamTransformationConstants.DYNAMIC_CONFIGURATION);
// set value
conf.put(keyURL, url);
So what has to be filled instead of XXXXX ?
Regards,
Marc -
ABAP XSL mapping - Binary data of attached file
I have a webservice which is converting attachment and putting it into XSLT Node. when I mapped this node to Attachment payload of my partner (using ABAP xsl mapping), I got an error.
I was able to send the same file via SOAP UI...
On further investigation of the http log files, I noticed that Binary data for both streams looked same, but when I did a word count, I noticed that SOAP UI was a single line file while my PI data was more than 400 lines.. so I coded a fn:transfer of this data to convert end of line character to empty value. it did seem to work...
My question, is this approach correct? or is there any way to ensure binary data stream in XML node does not contain those additional characters?can you provide input xml
Edited by: RajuGA on Dec 7, 2011 2:09 PM -
How to receive the images / binary data t ype
How to receive the images / binary data type in webdynpro....
i have a website that let's the user send email, the email attachment and message are stored in both in images data type....
q1) can i stored the message into binary data type...but the message is very long.....
q2) if i have a textbox ...i surely will need to display the message in string ,right ?
[......... msg here ........]
what is the codes to receive the images / binary data type in webdynpro....As in your previous post if you are storing them as BLOB object.. am sure you are able to get a byte stream or byte array(bytes[]) out of it.
There should be some way to identify if its a image or a message BLOB. If its a image , convert into bytes and use
WDWebResource.getWebResource(bytes,resource type).getAbsoluteURL()
to obtain the url.. assign this image UI element..
In case its the message , use bytes.toString to get the message ..
Regards
Bharathwaj -
Reading the binary data from a http request received via socket connection.
1. I require to extract the binary data out of a http multipart request,
2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
4. From there i need to read all of the binary content and put it in a file.
5. I did some implementation to his effect. but i see that the file that i had uploaded initially if its not a text file, gets corrupted.
can you please let me know why is that happening, and a probable solution approach.
please find below the class (with a main method) I have been using to expose a server socket.
package self.services;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class FileServer {
public static void main(String[] args) throws Exception {
ServerSocket serverSocket = new ServerSocket(9999);
String FOLDER_NAME = "uploaded_files";
while(true) {
try{
Socket socket = serverSocket.accept();
InputStream is = socket.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String currentLine;
int cnt = 0;
boolean postRequest = false;
String dataBoundary = null;
String fileName = null;
String yourName = null;
while((currentLine = reader.readLine()) != null) {
if(currentLine.contains("POST")) {
postRequest = true;
System.out.println("POST REQ AS EXPECTED VERY NICE");
continue;
if(!postRequest) {
System.out.println("NO POST REQ THIS BREAKING FLOW");
break;
} else {
if(currentLine.contains("Content-Type: multipart/form-data; boundary=")) {
System.out.println("found a boundary value header");
dataBoundary = currentLine.substring((currentLine.indexOf("boundary=") + "boundary=".length()), (currentLine.length() -1));
System.out.println("boundary value = ".concat(dataBoundary));
continue;
if(dataBoundary != null && currentLine.contains(dataBoundary)) {
cnt++;
if(cnt == 1) {
//move 3 lines
if(currentLine.contains("Content-Disposition: form-data; name=\"yourName\"")){
reader.readLine();//skip a line
System.out.println("Your name = ".concat(yourName = reader.readLine()));
continue;
} else if(cnt == 2) {
if(currentLine.contains("Content-Disposition: form-data; name=\"sentFile\"; filename=\"")){
fileName = currentLine.substring(currentLine.indexOf("filename=") + "filename=".length() + 1, currentLine.length() - 1);
System.out.println("File Name = ".concat(fileName));
reader.readLine();//skip a line , this would depict a content type header
reader.readLine();//skip a line, this would indicate a blank line to mark the start of data.
continue;
} else {
// write the content to os
if(currentLine != null && !currentLine.contains(dataBoundary)) {
baos.write(currentLine.concat("\r").getBytes());
} else if( cnt == 3) {
System.out.println(("cnt [" + cnt).concat( "], current line [").concat(currentLine).concat("]"));
break;
if(fileName == null ||yourName == null) {
System.out.println("FileServer.main() dont bother about this" );
} else {
//send a response back
PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
pw.write(responseMessage(yourName, fileName));
pw.flush();
//close output stream
pw.close();
//handle the request bytearray.
FileOutputStream fos = new FileOutputStream(FOLDER_NAME + "/" + fileName);
fos.write(baos.toByteArray(), 0, baos.toByteArray().length - 1);
fos.close();
//close input stream
reader.close();
socket.close();
baos.close();
} catch(Exception ex) {
ex.printStackTrace();
public static String responseMessage(String yourName, String fileName) {
String response =
"<HTML>" .concat(
"<BODY>") .concat(
"<P>" ).concat(
"Mr. <FONT color=\"red\">") .concat( yourName).concat("</FONT>. Your file named <B>").concat( fileName).concat( "</B> successfully reached us." ).concat(
"</P>") .concat(
"</BODY>").concat(
"</HTML>");
return response;
}{code}
Here is a sample html file which can be used to send multipart requests to the java service.
<html>
<body>
<form action="http://localhost:9999" enctype="multipart/form-data" method="POST">
Enter name :<br/>
<input type="text" name="yourName"/>
Enter file :<br/>
<input type="file" name="sentFile"/>
<br/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
*Both the form elements are mandatory*
*I hope my requirement is clear. Any help regarding this will be highly appreciated.*
Regards.MishraC wrote:
1. I require to extract the binary data out of a http multipart request,
2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
4. From there i need to read all of the binary content and put it in a file.
5. I did some implementation to his effect. but
i see that the file that i had uploaded initially if its not a text file, gets corrupted.
can you please let me know why is that happening,Because you are using a Reader (which translates bytes to chars according to the charset encoding specified).
and a probable solution approach. Use a BufferedInputStream.
Maybe you are looking for
-
I purchased a TV episode on itunes, put it on my 4g Touch, went to the Apple Store, bought an HDMI adapter and HDMI cable from them, came home, hooked it up, and I get a message that says I can't view it on my TV because it's protected. Is there a s
-
HOW DO I ADJUST AND COLOR THE SCROLL BAR
MAKE IT WIDER THAN IT IS AND MAKE IT A DIFFERENT COLOR TO SHOW UP BETTER
-
Hi, i'm facing a problem when i try to get the Chinese word from database. It should display "�W��������" rather then "?????". i tried to change the page encoding from "UTF-8" to "GB2312" but it still doesn't work. Anyone have any idea on this? Thank
-
Log4j problem for backing up the log file
This is my log4j.properties. it doesn't seem to back up the log file and create a new log file when it reaches to MAX size. can anybody look at it? Thanks.. log4j.rootCategory=debug, stdout, R # Print only messages of priority WARN or higher for your
-
SQL*LDR - reading num of chars instead of a line
Is there a way we can make LDR to read number of characters instead of a line at a time from the input data file?