I was wondering how good is to get an object bytes and convert them to HEX in order to send it through a web service, and then in the client side, they will convert the HEX to the same object. I already try this and it works, but I don't know if it is a good practice. Thank you.
Related
I work on Chat server in c++, data tranfser between client(dart) and server(c++), i want to use AES encryption for data and i have many question
1_ Which one should I choose? AES-GCM or AES-CTR, If you prefer another method of doing this, please explain.
2_ I know of several library and class for this, such as AesCryptoServiceProvider Class , Crypto++ which one do you think I should use, or if you know another library or documation , name it
3_ In my previous experience, i changed data like message and message information to string, encrypted string , add the first and last encrypted string with a special character so that I can get the healthy data and finaly i decrypted in server or client and it worked well, my question here is this the standard method? because i have heard elsewhere that each byte must be encrypted separately and sent with a socket, not collectively.
4_I did not find a good library for aes inside the dart, and my question is that I can write the class for decrypt and encrypt data in c++ and use in dart ?
thanks
sorry for absolutly murdering the tilte. But I am not sure how to frame this question, please edit this if there is a better way of explaining my problem.
I am reading a bitstream from a program which I convert into json data, write it to a socket, where another program reads this data and appends it to a log.json file. I am doing all of this in C++
Now I want to display this data in a better way. So why not try to display this in an html document, with some css applied on it.
My first thought was to simply fetch this with javascript. But now-a-days this throws an error.
So my second thought was to create a simple node.js server which accepts GET requests and then use this to serve the file. But this feels like its a bit overkill.
My third thought is now to perhaps use my original server (who continuously reads from the socket). And use that one to also accept http requests. But then I would have to multithread it, which again seems kinda overkill.
So im kinda falling back to needing 2 different "servers". One that reads from the socket and appends to the log file and another to serve this file to the website.
Am I'm thinking wrong here? What would be a good way to solve this?
Server A needs to send raw string data to Server B via http API calls.
Server B must parse and manipulate raw string data and then send resulting key/value pairs to Server C, via http API calls.
Server A cannot talk to Server C directly.
The operations to take place are:
Reception of string data (~8k of poorly formatted XML)
Manipulation of string data
Sending of string data
All of this must happen at scale, meaning thousands of times per second, from hundreds of different clients.
Perhaps nginx as a host, since it's great at concurrency? If so, what's the most efficient language to use behind it for the text manipulation, parsing and sending?
I also thought node might be a good option, since it has all the string manipulation functions built-in, as well as the protocols for sending and receiving data.
Very interested in hearing thoughts on the best way to approach this.
I have a Qt TCP Server and Client program which can interact with each other. The Server can send some function generated data to the socket using Qtextstream. And the Client reads the data from the socket using simple readAll() and displays to a QtextEdit.
Now my data from Server side is huge (around 7000+ samples ) and I need the data to appear on the Client side instantaneously. I have learned that using XML will help in my case. So, I made an Qt XML Server and it generates the whole xml data into a .xml file. I read the .xml file in Client side and I can get to display its contents. I used the DOM method for parsing. But I get the data to display only when all the 7000+ samples have been generated on the Server side.
I need clarifications on these questions:
How do I write each element of the XML Server side in to a String and send them through socket? I learnt tagName() can help me, but I have not been able to figure out how.
Is there any other way other than the String method to get a single element generated in the Server side to appear in the Client side.
PS: I am a newbie, forgive my ignorance. Thank you.
Most DOM XML parsers require a complete, well-formed XML document before they'll do anything with it. That's precisely what you see: your data is processed only after all of the samples have been received.
You need to use an incremental parser that doesn't care about the XML document not being complete yet.
On the other hand: if you're not requiring XML for interoperability with 3rd party systems, you're probably wasting a lot of resources by using it. I don't know where you've "learned" that XML will "help in your case". To me it's not learning, it's just following the crowd without understanding what's going on. Is your requirement to use XML or to move the data around? Moving data around has been a well understood problem for decades. Computers "speak" binary. No need to work around it, you know. If all you need is to move around some numbers, use QDataStream and be done with it. It'll be two orders of magnitude faster than the fastest XML parsers, you'll transmit an order of magnitude less data, and everyone will live happily ever after*.
*living happily ever after not guaranteed, individual results may vary.
I have a web service accessed via SOAP. I'd really like one of the methods to return a Stream.
What are my options?
My thoughts right now amount to implement Stream and stuff all the data in a string. Is there a type that does this already? If possible (and I don't think it is) I'd love to actually tunnel the stream through SOAP so that data gets pulled lazily even after the method returns.
Your best bet is to read the Stream into a byte array. You can then serialize the byte array in the web service. The client can then consume the raw byte array and re-assemble it into it's original format.
I've also used the same strategy for uploading files via web service it worked great.