Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 22:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



boost::asio::read_until problem

Discussion on boost::asio::read_until problem within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2013
Posts: 135
Received Thanks: 44
boost::asio::read_until problem

N' Abend,

ich habe ein kleines Problem, und zwar liest boost::asio::read_until Bytes bis zu einem bestimmten Delimiter, es kann aber durchaus vorkommen das mehr Daten im Receive Buffer geschrieben werden, als der Delimiter endet.

Quote:
After a successful read_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read_until operation to examine.
Somit habe ich mir etwas geschrieben, um alle vollständigen Packets von dem Receive Buffer zu bekommen, dass klappt auch soweit.
Das Problem hierbei ist aber, wenn ein unvollständiges Packet am Ende steht, versucht er es zu verarbeiten und anschließend zu löschen.(logisch warum)


Es gibt keine 0 terminierenden Packets, bevor jemand fragt. ;o
Code:
std::string packet_sequence;
std::istream stream(&_bufReceive);
while(!std::getline(stream, packet_sequence, static_cast<char>(buf_delim)).eof())
{
	_packetHandler->process(_packetEncoding->decryptLoginPacket(packet_sequence));
	_bufReceive.consume(packet_sequence.size());
}
Beispiel vollständiges Packet (0xFF = Packet end):
Code:
request_login <user> <password> 0xFF
Beispiel unvollständiges Packet (first call):
Code:
request_login <user> <password> 0xFF request_something <so
Um das Problem zu lösen, müsste std::getline den letzten Abschnitt ignorieren, da dort das 0xFF fehlt.

Packet (second call):
Code:
mething> 0xFF
Ich könnte jetzt einfach eine eigene Split-Funktion schreiben, aber mir währe es lieber den obigen Code um eine Funktion ergänzen zu können und deswegen frage ich euch, ob wer eine Idee parat hätte.
EasyTale is offline  
Reply


Similar Threads Similar Threads
boost::asio::buffer Problem
11/15/2013 - C/C++ - 13 Replies
Hello guys, i am writing a private server in c++ and i searched a library for networking. Boost was referenced really often so i used it. Now i want to write something to the socket by using boost::asio::async_write(). The problem is that i need to concat 3 things. The first thing is a string the second thing an string and the third a string aswell. I tried this: boost::asio::async_write(sock,boost::asio::buffer ("RDY|I|" + x + ...
buying boost problem..
07/24/2013 - Need for Speed World - 6 Replies
why i get this everytime i put my card number? We're sorry, but we can't perform transactions to this credit card. Please load a different one. anyone had the same before?
problem buy boost
02/27/2013 - Need for Speed World - 2 Replies
i use this tutorial for ghet boost from poland before.tutorial link(from shotgun): http://www.elitepvpers.com/forum/need-speed-world /2304793-no-more-cheep-boost-poland.html but now I tried to buy but no work (EA detect my real country) We need your help.
Elo Boost problem
07/01/2012 - League of Legends Trading - 12 Replies
I had a problem with this user: http://www.elitepvpers.com/forum/league-legends-t rading/1878497-elo-boosting-service-up-2300-elo.ht ml We agreed i should pay him monday afternoon for some elo boost and tonight i find my password not working and the email changed. He played from 1034 to 1087 elo and he told me i cannot access my account until i pay him. I don't think elo boosters should change emails and passwords, i was going to pay anyway. I am still going to pay him 9 euro for that...
[COD8]Mw3 Pc Xp Boost? No Problem!
12/01/2011 - Call of Duty - 2 Replies
Hallo Elitepvper... Ich würde euch heute gerne einen ,,Super Xp Boost´´ Server vorstellen! Auf dem Server levelt man mit einem Kill biss level 80!!! (999.999 Punkte pro Kill) Connecten? Kein problem! Ihr öffnet Cod -> Serverliste -> und sucht euch einen Server mit der Endung: itsmods.com XPBOOST



All times are GMT +1. The time now is 22:04.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.