How to read a C structure with string and int with a java server using sock
I ve made a C agent returning some information and I want to get them with my java server. I ve settled communication with connected socket but I m only able to read strings.
I want to know how can I read strings and int with the same stream because they are sent at the same time:
C pgm sent structure :
char* chaine1;
char* chaine2;
int nb1;
int nb2;
I want to read this with my java stream I know readline methode to get the first two string but after two readline how should I do to get the two int values ?
Any idea would be a good help...
thanks.
Nicolas (France)
Does the server sent the ints in little endian or big endian format?
The class java.io.DataInputStream (with the method readInt()) can be used to read ints as binary from the stream - see if you can use it.
Similar Messages
-
How to read a data file combining strings and data
Hello,
I'm having a data file combining strings and datas to read. I'm trying to read the filename, time, constants and comments into four seperate string indicators (the lines for the comments varies for different files). And read the data into a 2-D numeric array. How can I do this? Is there any function that can serch special characters in the spreadsheet file so I can exactly locate where I should start reading the specific data. The following is how the data file appears. Thank you very much.
Best,
Richard
filename.dat
14:59:00 12/31/2009
Sample = 2451
Frequency = 300, Wait time = 2500
Temperature = 20
some comments
some comments
some comments
some comments
some comments
7.0000E+2 1.5810E-5
7.0050E+2 1.5400E-5
7.0100E+2 1.5500E-5
7.0150E+2 1.5180E-5
Message Edited by Richard1017 on 10-02-2009 03:10 PM
Solved!
Go to Solution.Hi,
I'm fairly new to the NI forums too and I think you just have to wait longer. Your post was done right. I do a similiar function as to what you are talking about except I read in numbers from a file. I create an ini file (just a notepad file of type *.ini) that is is set up with sections inside brackets [] and keys with whatever name followed by an = sign. You may be able to use a *.dat file too, I just haven't. Then the vi attached goes to that file and reads the keys from those sections. You just repeat for the different sections and keys you want to read. You can use similar provide VI's to write to that same file or create it. Let me know how that works.
Attachments:
Help1.ini 1 KB
Help1.vi 10 KB -
How to create a transport request with query and only with its structure.
HI guru,
how to create a transport request with query and only with its structure.transport request should not include any other query items like ( variables, conditions...etc)
thanks in advance.
venkataHi,
Goto RSA1 and then Transport Connection -> In SAP Transports select Object Types-> Query Elements -> Then select Query->Give Technical name of the query and then select for transfer. In the right side you can choose the components which you wanted to transport.
Regards,
anil -
I have an airport express and want to know how to set up two different wireless networks. One with 5GHZ and one with 2.4GHZ so different devices can connect to either. I have an iphone 4 that will not connect to 5ghz.
thank you!Your AirPort Express is already providing two separate 2.4 GHz and 5 GHz bands, but each band is using the same wireless network name.
This is the default setup for the AirPort Express, which is recommended for most users. The theory here is that devices will automatically connect to the best quality signal based on their capabilities and distance in relation to the AirPort Express.
It is possible to assign a different name to the 5 GHz band, and then "point" devices at that network to connect. Some users swear by this option.....(I am not one of them).... but you might want to give it a try to see how it works for you.
Open Macintosh HD > Applications > Utilities > AirPort Utility
Click on the AirPort Express
Click Edit in the smaller window that appears
Click the Wireless tab at the top of the next window
Click Wireless Options near the bottom of the next window
Enter a check mark next to 5 GHz Name.....which will automatically add "5 GHz" to the network name....so you can identify it
Click Save, then click Update and wait a full minute for the Express to restart
Now you will need to "point" your 5 GHz capable devices at the 5 GHz network name. 2.4 GHz devices will connect to your "other" network name. -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
Can not take a screenshot with Maverick and track pad. can not use apple chat to talk with a tech. there are other issues also like I used to be able to go back a page with the delete button. No Maverick PDF to instruct on how to use Maverick
THE use of the apple support is a mess also.
I want to be able to use my MAC fully and easily like I used to with Snow Leopard.
What is wrong with this maverick OS?The only people who can possibly assist you with this is Apple Customer Relations, call your local Apple contact number and ask for Customer Relations then explain your situation clearly and politely (be firm but don't rant).
You might want to investiage what the local laws are regarding defective goods and 'fit for use' definitions on warranties etc. Consumer Protection can be a useful tool to use or bargain with if needed ... -
Problem with String to Int conversion
Dear Friends,
Problem with String to Int conversion
I am having a column where most of the values are numeric. Only 4 values are non numeric.
I have replaces those non numeric values to numeric in order to maintain the data type.
CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END
This comes the result as down
Grade
_0_
_1_
_10_
_11_
_12_
_13_
_14_
_15_
_16_
_17_
_18_
_19_
_2_
_20_
_21_
_22_
_23_
_24_
_3_
_4_
_5_
_6_
_7_
_8_
_9_
Refresh
Now I want to convert this value to numeric and do some calculation
So I changed the formula as below
cast (CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as INT)
Now I get the following error
View Display Error
_ Odbc driver returned an error (SQLExecDirectW)._
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
_State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtFetch. [nQSError: 17012] Bulk fetch failed. (HY000)_
SQL Issued: SELECT cast ( CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as Int) saw0 FROM "Human Capital - Manpower Costing" WHERE LENGTH(CASE Grade.Grade WHEN 'E1' THEN '20' WHEN 'E2' THEN '21' WHEN 'E3' THEN '22' WHEN 'E4' THEN '23' ELSE Grade.Grade END) > 0 ORDER BY saw_0_
Refresh
Could anybody help me
Regards
Mustafa
Edited by: Musnet on Jun 29, 2010 5:42 AM
Edited by: Musnet on Jun 29, 2010 6:48 AMDear Kart,
This give me another hint, Yes you are right. There was one row which returns neither blank nor any value.
I have done the code like following and it works fine
Thanks again for your support
Regards
Code: cast (CASE (CASE WHEN Length(Grade.Grade)=0 THEN '--' ELSE Grade.Grade END) WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' when '--' then '-1' ELSE Grade.Grade END as Int) -
Hello, i was wondering if you can help me figure out how to edit a video to zoom in and out with the beat of the music?
Use markers on every beat.
The edit the zoom/scale to the markers.
Adobe Premiere Pro Help | Working with markers -
How do I delete sites created with iWeb and posted with .mac after a format
I am confused about how to delete a couple of sites that I created with iWeb and posted with my .mac after I did a format reload?
I have tried everything. The original files are not on my MacBook Pro because of the format.
I also see them in my idisc, but I is my understanding that on my MacBook Pro that I can delete the files, but they are hosted online. On the online idisk I cannot delete them because there is no option. Please help!!!Using the file menu in Finder:
Go/iDisk/My iDisk/Web/Sites/iWeb/YourSitesAreHere
Highlight selected files and Command/Delete. You will receive a drop down asking you if you are sure; click OK and the files/sites will be deleted immediately from the iDisk.
Mark -
How to run a remote windows dll files and the drivers of the system using j
Dear Friends,
I need some valuable info regd how to run a remote windows dll files and the drivers of the system using java
reply regd thanking youPlease don't make duplicate posts like this.
-
Matrix with CFL and RecordSet with DoQuery
Hello Experts,
How to use Matrix with CFL and RecordSet with DoQueryHi Manish,
Refer to SDK sample on CFL at ...\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList
Go to SDK Help, Developer's Guide -> DI DPI -> Reference -> Overview -> Objects -> Recordset
see the Example "Recordset Operations sample" at the bottom of the page
HTH
Aravind -
Why is my airportxpr only working with Itunes and not with another music program
why is my airportxpr only working with Itunes and not with another music program??
I can not select/see other outputs in my sound selector.You have not indicated which OS or which music program you have so I have listed a program called Airfoil to try for both Windows and Mac - it may work for you
for Windows - http://rogueamoeba.com/airfoil/windows/
for Mac - http://rogueamoeba.com/airfoil/mac/ -
Does Apple make/sell the new "Apple In-Ear Headphones with Remote and Mic" with a one sided configuration? So that a person that is deaf in one can hear both sides of a stereo recording? Also, since the "other" bud is not necessary/useful...it's removed.
As far as I know, Apple sells no such configuration. However, under Settings > General > Accessability, there is an option to play back audio in monoural mode, which would then play both halves of a stereo mix in each earbud.
Hope that helps. -
How to convert from UNICODE (UTF16) to UTF8 and vice-versa in JAVA.
Hi
I want to insert a string in format UTF16 to the database. How do I convert from UTF16 to UTF8 and vice- versa in JAVA?. What type must the database field be? Do I need a special set up for the database (oracle 8.i)?
thanks
nullI'm not sure if this is the correct topic, but we are having problems accessing our Japanese data stored in UTF-8 in our Oracle database using the JDBC thin driver. The data is submitted and extracted correctly using ODBC drivers, but inspection of the same data retrieved from the GetString() call using the JDBC thin driver shows frequent occurrences of bytes like "FF", which are not expected in either UTF8 or UCS2. My understanding is that accessing UTF8 in Java should involve NO NLS translation, since we are simply going from one Unicode encoding to another.
We are using Oracle version 8.0.4.
Can you tell me what we are doing wrong?
null -
If I get the iphone 5 with plan and contract with 2 years or 3 can i pay $25 each mouth for just ulimited texting and 250 min of talking.
Ask the carrier instead of making yourself look like a fool by posting such a question in a user to user technical support forum.
Maybe you are looking for
-
I have used Photoshop for many years, starting with my original licensed purchase of Photoshop 4. I have progressively upgraded this to my current CS5. However, my first Win 7 64-bit PC will not install the legacy version at all. So I can't then upgr
-
Necessary to "Update" old illustrator files?
I have tons of files created in old illustrator 6.0 and now that I have a newer version of illustrator, specifically CS2, loaded on Mac OS X it's calling all of my illustrator files "Text Files." It says, "This file contains text that was created in
-
Assignment of vendor to purchasing organization
Hi All, We are on SRM 5.0, classic scenario. In our test system, I replicated vendors some time ago. Now the backend has changed and I replicated some new vendors. Now, during shopping cart creation when when I try to assign source of supply, only fe
-
Sorting without reloading the page
Hi, I'd like to know how processing several sorting operations without reloading and ask the database each time the sorting of the elements is made. For that I guess a copy of the result tree obtained by the sql query, written in the xsql page, must
-
Help Importing DVD Files.
I have a dvd that someelse created, I guess typical DVD with a VIDEO_TS folder with mulitple .VOB and other files. How can I import this into Final Cut so that I can a movie clip and recreate a new DVD? What would be the simplest way of doing this? T