Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a std::multimap variable containing key-value data, and want to transfer it to a remote server over socket.
I known, in Java, we can serialize the object as byte stream and transfer it.
However, can I do the same thing in C++?
If not, how can I transfer std::multimap data over socket in C++?
Meanwhile, are there some other methods to transfer std::multimap data over socket without serialization, or using 3rd library?
Thanks in advance!
It can be done through boost::serialization, STL collection of it can be found here
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to transfer 32k data between client-server with WinSock2. Is it possible or there is a limitation with data?
"I want to transfer 32k data between client-server with WinSock2. Is it possible" - Yes.
32K is tiny. If you had asked about 2^32 or 2^64 bits of data, then you may have a situation where you could run into trouble. But 32K? No.
Also; Why didn't you just try? A simple test program would have shown you i 5min that transfering 32K of data is not a problem at all. Please make a minimal effort before asking a question.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have multiple listeners threads reading a stream of messages (Kafka). Each message has an identifier. The consumers/stream guarantees at-least once consumption. At most of the time, the stream would provide the message exactly once. The count of messages to expect is known beforehand. When all messages are received, I want to shutdown all listener threads. The number of messages can be at most 50 million. What data structure is most suitable for this?
I was thinking of using std::set, std::map and using a mutex at each insertion of the thread. Can a single thread be actually faster in such a use-case? Is there something more optimal?
std::unordered_map would be better. But you should consider using something like HyperLogLog
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Why are most data compression algorithms created with C++ or Java. Why not use javascript or even ruby? Is it dependent on the file type you are trying to compress such as text,video or even audio files?
If you need to compress data, it is probably because you have a lot of data; as such, the performance of such algorithms is pretty important, and other things being equal, a compiled language typically performs better on the kind of low-level data manipulation such algorithms employ than an interpreted one.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i have some idea about file remote location.Can i split a file in to chunks and use thread control split and socket to implement split data and send meanwhile ?
Besides, local can prefetch remote chunk and read it by two thread?
If you have one source of data and one sink I would assume that chunking won't help.
The IP-stack itself uses this method, so as long as you can provide data fast enough to the TCP stack (write buffer) and are fast enough reading the data from the buffer (read buffer) I think that is as fast as it gets...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
In my c++ application, I want to get the HTTP messages such like GET/200OK, and then parse them in to my own struct. How can I get them from the networking card in the run time?
You can try using libucyrl mentioned in this answer.
Also you can write your own TCP client/server application and read the data from sockets, then parse it the way you want it. In this case is better to familiarize first with the HTTP protocol.
I think some tutorials might be useful too, so here are a couple of links:
http://www.freeos.com/articles/4121/
http://www.jmarshall.com/easy/http/