Sending Chararray of hexadecimal
Hi everyone.
im trying to send a chararray of hexadecimal in a socket, but when i catch it on the server it's not the same chararray...
this is the array i am sending from the client:
char[] _envio = {0x00,0x4C,0x60,0x00,0x05,0x80,0xE3,0x08,0x00,0x20,0x20,0x61,0x01,0x80,0xC0,0x00,0x02,
0x95,0x00,0x00,0x01,0x05,0x82,0x12,0x34,0x01,0x23,0x00,0x01};and this is what i am getting on the server:
0 4C 60 05 3F E3 8 0 20 20 61 1 3F C0 02 3F 0 0 15 3F12 34 1 23 01
note that the problem is when the hexadecimal is 0x80, 0x95 and 0x82 it is always change by 3F...
can someone tell me why this is happening?
this is how i am sending the chararray
char[] _envio = {0x00,0x4C,0x60,0x00,0x05,0x80,0xE3,0x08,0x00,0x20,0x20,0x61,0x01,0x80,0xC0,0x00,0x02,
0x95,0x00,0x00,0x01,0x05,0x82,0x12,0x34,0x01,0x23,0x00,0x01};
try
_serversocket = new Socket(_ipserver, _portserver);
_out = new PrintStream(_serversocket.getOutputStream());
_in = new BufferedReader(new InputStreamReader(
_serversocket.getInputStream()));
_out.println(_envio);
catch (UnknownHostException ex)
ex.printStackTrace();
}and this is how i am chatching it in the server
try
_in = new BufferedReader(new InputStreamReader(
_clientsocket.getInputStream()));
_out = new PrintStream(_clientsocket.getOutputStream());
_in.read(_msj);
System.out.print("Mensaje del cliente: ");
for(int i = 0; i < _msj.length; i++)
System.out.print(Integer.toHexString((int)_msj).toUpperCase());
System.out.println();
catch (IOException ex)
ex.printStackTrace();
Instead of PrintStream and BufferedReader (with InputStreamReader) you should use [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/DataOutputStream.html#writeChar(int)]DataOutputStream.writeChar() and [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/DataInputStream.html#readChar()]DataInputStream.readChar() because there is no special conversion involved.// client:
_out = new DataOutputStream(_serversocket.getOutputStream());
for (int i = 0; i < _envio.length; i++)
_out.writeChar(_envio);
// server:
in = new DataInputStream(clientsocket.getInputStream());
for (int i = 0; i < _msj.length; i++)
_msj[i] = _in.readChar();Regards
Similar Messages
-
Text mode opened file and line feed
Good morning:
I have open a file in text mode and i need to send an OD0A hexadecimal characters to another system in each line, if i try to put 0D0A it makes a double line feed and if i only put 0D it doesn´t interpretate 0D like hexadecimal characters, i know that if i open the file with binary mode it would be very easy, but it is a code shared with another programs, so i rather not to change. Does anybody has made that in text mode in any occasion?.
Thanks in advance
Regardsi have open the file in binary mode
-
PDA Bluetooth breakpoint oddity
Hi all,
I was wondering if any of you have tried to write a labview program for the pocket pc platform to communicate with another device over bluetooth.
I am currently trying to communicate with this RFID reader. The pocketpc will send a request (hexadecimal string) to the RFID reader and the reader will respond with a corresponding reply, almost immediately after the request was sent. I am able to successfully do a one way send to the RFID reader (the respond could be heard by a beeping sound that it emitted) and a one way receive from the reader (when I explicitly press a button to transmit information from the reader to the pda), but I am unable to do both at the same time (ie send the request and read the reply from the bluetooth connection). However, I am able to send a request and see the reply if I were to put a breakpoint and slowly enumerate through each step.
I am puzzled by the fact that the program works perfectly fine in the debug mode with the breakpoint, but I am unable to see anything when I run it in the normal mode. I keep getting a bt-read error 4 when I run in the normal mode without breakpoints.
I tried the same program on 2 different PDAs and they both yielded the same results. I have attached the modified program from the simple bluetooth example in this post. (This example is written in labview 7.1)
Does anyone have the same experience or any idea what is going on?
Attachments:
try.vi 37 KBHi all,
I've solved the problem already.
Posting this message for reference purposes:
Basically the problem lay with the device. It had a certain delay and I was writing immediately after I just established a connection with it. Hence, the information sent over after the open connection might have not been registered.
The breakpoint in the question sort of adds a delay such that the connection is properly established before I send the write to the device.
Hope this might help a little for anyone who might encounter the same problem. -
Unexpected hexadecimal 00 send over serial communication
Hi,
I'm connecting a Tesa tt20 with a serial port. TT20 measures thickness and returns a 6 digit fractional number (0.0000). Communication works fine on most desktops and/or laptops. I have to say that i throw away the first measurement, because values where not to be trusted.
In one case, the following occures :
Sometimes there are gaps between the numbers.
Something like this : 1. 23 or 0.0 2
Examining this string in codes display, the gap appears to be \00 or in very rare cases \s
When we connect a laptop on the same TT20, communication works fine
It seems to be a problem with the desktop, some kind of setup -parameter ?
I was wondering if anyone has encoutered the same problem ?
Thanks in advance
Regards
ChristineCenterbolt,
I gathered a bit of info.
The same cable is used on desktop and portable
It seems to be an optical RS232
In attachment you will find the communications spec for the TT20. Not much to go on. But i am not a specialist on this.
I am using labv 8.2.1
You are right about the timing. I will make a version where i will make sure that the wait comes before the property node
Many thanks
Regards
Christine
Attachments:
RS232_UK pg80.jpg 73 KB -
A fairly simple question, I'm sure, but I'm stumped - I'm trying to send plaintext to a LaserJet P2055d as a downlevel job {i.e. simply copying a file to the share path}. However, it includes a number of central European characters such as žđćšč which print incorrectly. So, after a full day of unsuccessful messing around and experimentation, I figured I might as well hijack someone else's expertise - what sequence do I need to send/prepend the text with for:
Fixed-space regular font {ideally Courier, but as long as it's not too silly, I'm not picky}
Using CE characters like ŽĐĆŠČ {the text file is encoded as ANSI, but that can be changed if needed}
I'd really appreciate help with this - I suspect my problem is defining the wrong typeface family or something. I'm kind of out of ideas.
This question was solved.
View Solution.>> ... such as žđćšč
>> ... characters like ŽĐĆŠČ
>> ... the text file is encoded as ANSI, but that can be changed if needed
The term ANSI is a somewhat loose term.
The character set commonly known as Windows ANSI (Code Page 1252) is a superset of the ISO-8859-1 Latin-1 character set, which uses some of the codes in the (little-used) C1 control-code range (0x80-0x9f) to represent graphic characters.
Whilst this includes some of your characters (the upper-and lower-case 'z with caron', 'eth' and 's with caron'), it does not include all of them (not 'c with acute accent' or 'c with caron').
ANSI (it appears - see http://en.wikipedia.org/wiki/Windows_code_pages ) can also be used to refer to a number of different Windows Code Pages, including Code Page 1250, which is for Central European languages, so this is (possibly) the one that your documents are encoded with.
If so, you could try prepending your data with the following PCL symbol set/typeface escape sequences:
<Esc>(9E<Esc>(s0p10h0s0b4099T
where:
<Esc> represents the (non-graphic) Escape control-code character (the character with decimal code 27, or hexadecimal 1B).
This font selection sequence should select the Courier Regular typeface at 10 characters-per-inch.
Changing 9E to 19U would select the standard Western European (Code Page 1252) character set. -
Problem in file sender adapter for newline character
Hi All,
I'm trying to read a file of only one record with the following fields.
Name
Age
Place
<b>Each field is seperated by a new line</b> which is the cause of the problem.
<b>The problem is the value 'nl' for x.fieldSeperator is not been recognised in file sender adapter.</b>
The adapter creates a new record (new XML) for each individual field seperated by new line.
<b>I've tried even with the corresponding hexadecimal values '0x0a' and '0x0d'.</b>
Looking for some help.
Thanks,
Joe.Hi Shabarish,
Thanks for your reply. But I tried that too already... It also didn't work..
File adapter is successful... But it generates seperate records for each fields that's wat the prob is..
Thanks,
Joe. -
File Content Conversion - Sender File Adapter - Record Delimeter ~
The inbound file has file has ~ as record delimeter. I am using the FCC at sender file adapter to covert this file into XML. Somehow, the file adapter is not able to interpret "~" as my record delimeter even thoough I specified "record.endSeparator = ~" in FCC.
Would someone help me with a solution?Raju,
You can also try to use the '0x7E' as endSeperator condition.
I am not sure if the HTML tag will work but this should do the trick. This should be the HEX corresponding entry
char description hex char code html
" ~ " "Tilde" "0x7e" "~" &!tilde; (without !)
greets.
in adition to this see SAP help
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/655453b48a4ddfe10000000a1553f7/frameset.htm
Special Characters in Strings for Separators
In all strings for separators (NameA.fieldSeparator, NameA.beginSeparator, NameA.endSeparator), you can specify non-printable ASCII characters. These characters can each be inserted individually in the strings in the form ´0xHH´ (including the quotation marks), where HH represents the character encoded as a hexadecimal value.
Please also ensure that the "recordSet Structure" also need to be configured Correctly
for example:
Header,1,Detail,*
Header.fieldSeperator --> %parameter%
Detail.fieldSeperator --> %parameter%
Detail.endSeparator --> '0x7e'
Greets -
Converting hexadecimal XML data to a string
Hello!
Until now I generated XML data with the FM 'SDIXML_DOM_TO_XML'.
After that I did a loop over the xml_as_table in which I was casting each line of that table to a string.
ASSIGN <line> TO <line_c> CASTING.
After the inftroduction of unicode in our system I get a error:
In the current program an error occured when setting the field symbol <LINE_C> with ASSIGN or ASSIGNING (maybe in combination with the CASTING addition).
When converting the base entry of the field symbol <LINE_C> (number in base table: 32776), it was found that the target type requests a memory alignment of 2
What does it mean? Does somebody have a solution.
I need this function for sending this XML data as string over a simple old CPIC connection.
Best regards
MartinHello Martin
Perhaps my sample report ZUS_SDN_XML_XSTRING_TO_STRING provides a solution for your problem.
*& Report ZUS_SDN_XML_XSTRING_TO_STRING
*& Thread: Converting hexadecimal XML data to a string
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1029652"></a>
REPORT zus_sdn_xml_xstring_to_string.
*-- data
*-- read the XML document from the frontend machine
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: xml_table TYPE TABLE OF xml_line.
DATA: go_xml_doc TYPE REF TO cl_xml_document,
gd_xml_string TYPE string,
gd_rc TYPE i.
PARAMETERS:
p_file TYPE localfile DEFAULT 'C:payload_idoc.xml'.
START-OF-SELECTION.
CREATE OBJECT go_xml_doc.
" Load XML file from PC and get XML itab
CALL METHOD go_xml_doc->import_from_file
EXPORTING
filename = p_file
RECEIVING
retcode = gd_rc.
CALL METHOD go_xml_doc->get_as_table
IMPORTING
table = xml_table
* size =
* retcode =
" NOTE: simulate creation of XML itab
go_xml_doc->display( ).
create object go_xml_doc.
CALL METHOD go_xml_doc->parse_table
EXPORTING
table = xml_table
* size = 0
receiving
retcode = gd_rc.
CALL METHOD go_xml_doc->render_2_string
* EXPORTING
* pretty_print = 'X'
IMPORTING
retcode = gd_rc
stream = gd_xml_string
* size =
write: / gd_xml_string.
END-OF-SELECTION.
Regards
Uwe -
Convert UTF-16 string to UTF-8 or Hexadecimal
we are working on SMS Application .we are sending UTF-8 bit it's working fine but we are try to send UTF-18 then we got unknow string. any body help me how to convet UTF-16 to UTF-8 or Hexadecimal.
It is not clear to me what you are asking. I will assume that you have a String object and you want to get the utf-8 equivalent bytes so you can write them out to SMS. In Java, all String objects internally store the characters as UTF-18 and you can get the utf-8 equivalent using
String s = ...
byte[] utf8BytesOfS = s.getBytes("utf-8");
Edited by: sabre150 on Aug 21, 2008 6:12 AM -
Sender File (FCC) - Content of File into single XML Tag
Hi,
Input file
This is Line1
This is Line2
Expected Sender File adapter FCC into XML
<Document>
.<File>
..<Content> This is line 1 This is line2</content>
.</File>
</Document>
FCC is giving the following output with the below config,
File.fieldNames = Content
File.fieldSeparator = '0x1A' (HexaDecimal rep for EndOfFile)
<Document>
.<File>
..<Content>This is line 1</content>
..<Content>This is line 2</content>
.</File>
</Document>
How can i read the complete file into a single XML tag?
I am aware of other options (AdapterModules or Javamapping). But i want to keep it simple to FileAdapter using FCC or using MessageTransformBean (if possible)
-SMFCC donse't work here, So i wrote a simple Java map inside Execute method to convert the content to the required format.
public void execute(InputStream in, OutputStream out) throws StreamTransformationException{
StringBuilder sb = new StringBuilder();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line).append("\r\n");
} finally {
in.close();
After i had the input string, i formatted it to get the required output as XML ...
<Document>
.<File>
..<Content> This is line 1 This is line2</content>
.</File>
</Document> -
Flat file assembler. Hexadecimal value XYZ, is an invalid character
Hi,
I'm trying to send file that contains base64-encoded string. With simple xml FTP sending - all works fine. But with flat file pipeline comes this error:
A message sent to adapter "FTP" on send port "....FlatFile" with URI "ftp://..../.../%SourceFileName%" is suspended.
Error details: There was a failure executing the send pipeline: "...., ....Pipelines, Version=1.0.0.1, Culture=neutral, PublicKeyToken=.."
Source: "Flat file assembler"
Send Port: "MyFlatFile" URI: "ftp://.../.../%SourceFileName%" Reason: '', hexadecimal value 0x03, is an invalid character. Line 1, position 100.
Pipeline:
Is it impossible to do such operation on Biztalk?
Thank you!Try to set the appropriate value to the "Target charset" property in the Flat file assembler component. This would solve your issue.
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful. -
Multiple source files from multiple directories in sender CC
Dear all,
My requirrement is that ,I need to use multiple directories in sender CC (only one) and send the files to receivers.
Kindly let me know how it can be done.
Thanks,
SrinivasaHi,
under advanced tab.............If you set the Enable indicator, you can enter variables for the Target Directory and File Name Scheme. Enter the names of the variables and references in the table.
● Enter each variable that you reference in the Target Directory and File Name Scheme fields without the surrounding percentage sign under Name of Variables in the table.
The variables can refer to attributes of the message header or elements of the message payload.
○ If the variables are to refer to an attribute of the message header, add the prefix message: to the name of the variable under Reference. You can specify the following attributes of the message header:
sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,
message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)
message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)
For example, if you want to specify the interface name from the message header in the target directory or in the file name scheme, enter message:interface_name as the reference.
If one of the message attributes contains characters that are not permitted in a file name, for example \, /, :, *, ?, ", <, >, |, then these characters are replaced by an underscore ("_").
○ If the variable refers to an element in XML schema, add the prefix payload: to the information under Reference. The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....
namea,nameb,...corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.
The description begins at the root of the document and ends at the respective element.
To reference the element that is in bold in the example, the following expression is used: payload:root,1,e1,1,e2,2
The parser searches for the first occurrence of the root element at the first level. It then searches for the first occurrence of e1 at the second level and for the second occurrence of e2 at the third level. The content of the last element (“Example Value”) is set as the value for a specified variable.
Thanks,
Madhu -
Plain HTTP sender adapter - Extract XML from request
Hi all,
I face a blocking issue in one of my B2B process.
A marketplace must send Purchase orders to my customer with synchronous HTTPs requests.
When messages arrive, we can see the following payload in incoming message (SXMB_MONI)
%24xmldata=+%3C%3Fxmlversion%3D%221.0%22encoding%3D%22UTF-8%22%3F%3E%0D%0A-%3CMessage%3E%0D%0A-%3CHeader%3E%0D%0A%3CFrom%3EPA%3C%2FFrom%3E%0D%0A+%3CTo%3E83092SAC01%3C%2FTo%3E%0D%0A+%3CDocType%3ETAEPa-xCBL30PO%3C%2FDocType%3E%0D%0A++%3CDocID%3EP-20050502T125611-TATG310-
%0D%0A++%3C%2FMessage%3E&submit=Soumission
WebServer of B2B partners don't put XML data in HTTP body but as HTML form in .
Is there a way in Plain http adapter to interpret such a request ?
How can we decode hexadecimal sequence ?
Thanks to help us.
Jean-CharlesHi Jean-Charles !
Unfortunately, I don't know any other option (based on XI; maybe you can develop some kind of external translator between your system and XI's http adapter). The first link (although it is based on a escenario in the oposite direction) speaks about using java proxy instead of the http adapter.
Here are some links:
/people/thorsten.nordholmsbirk/blog/2006/08/06/use-a-java-proxy-instead-of-a-jca-adapter
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30572c6a-d311-2a10-99ab-f646ec3b5b12
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06315a6-e66e-2910-039c-ba8bbbd23702
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+proxy&adv=false&sortby=cm_rnd_rankvalue&start=21#
Regards,
Matias
ps: please award points if helpful. -
Sending XML file as attachment in E-mail
Hi,
I'm facing a problem with sending e-mails with an XML-file as attachment. Scenario is as follows:
- I collect the payload from XI with FM 'SXMB_READ_MESSAGE_VERSION_RAW'.
- This payload is in the form of an xstring.
- I convert this xstring to binary content by using FM 'SCMS_XSTRING_TO_BINARY'.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_buffer
* APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_conhex.
The itab lt_conhex is of type solix_tab.This is used finally to send the mail via class CL_BCS following normal procedures. Now when I open the e-mail with attachments I get the error that in the last line of my xml-file some squares are placed, which causes the document to open incorrectly. When I delete the squares via e.g. notepad and open my xml-file again in my internet browser, it opens correctly.
If I look at the contents of the solix_tab I see that the last line of the hexadecimal values are zero's, probably causing the XML file to be attached/oopened incorrectly. Is there any way to replace these zero's with some hexadecimal value in order to display my XML-file correctly?
Kind regards!Thanks Sandra,
Overlooked that parameter. Indeed if you take the XSTRLEN of the document and place this in the method for creating the attachment it works fine.
CALL METHOD lo_email->add_attachment
EXPORTING
i_attachment_type = ls_email-type
i_attachment_subject = ls_email-subject
i_att_content_hex = ls_email-content_hex
i_attachment_size = ls_email-content_length.
By the way...if you're dealing with PDF documents this documentlength doesn't matter. -
Comparison in hexadecimal - help needed
hello,
i am basically using VISA read and write. There is infor sent to my computer using RS232. Only when i recieve that infor
I need to send out some data. so I open up visa and start "VISA Read". the information coming in is:
"01,\n\r" or in hexadecimal: 30 31 2C 0D 0A
I then use a comparison to see if the above matches with a string that is the same as above..
BUT THE PROBLEM IS IT ALWAYS SHOWS FALSE THAT THE STRING DOES NOT MATCH???
does anyone know why??
thanks
any similar VI'sFlip the last two characters:
"01,\n\r" is 30 31 2C 0A 0D (not 30 31 2C 0D 0A!)
LabVIEW Champion . Do more with less code and in less time .
Maybe you are looking for
-
I upgraded my 3gs to the iOS5 software, but it keeps telling me on my iphone and my itunes that it cannot activate my iphone! Then my iTunes said there is no SIM card installed. HELP! I can't seem to even restore, which is what I was told to do by th
-
IDOC Receiveir Communication channel
Hi Team i have created a IDOC receiver CC. i ahve to define the alerts for my scenario. the condition is that " if the connectivity between the PI system and the receiver(R/3) system is lost an Alert has to be raised. In RWB we can stop and start the
-
Data Inconsistent at Standard Structure IS_BIL_INVOICE-IT_GEN
Dear Experts, I am working on an invoice,data is inconsistent at standard structure is_bil_invoice-it_gen. I have 26 line items in one invoice but standard structure displays 38 line items. Also i checked standard structure at the
-
Hello, my user has stopped working I've reset the password for the user twice and still not working.
-
Where can I download my lost apps
i have lost every apps in my nokia n8 such as photo n video editor, quick office, pdf reader etc..so from wer i can get this...plez help me...