Saltar al contenido ForoHackers

Why did my reading program eat exactly half a sentence and act full?

Protocolos de redPythonPruebas
#8729 · · Citar · Denunciar

Local toy only. First byte says five, followed by HELLO. I feed it in two chunks, the first one has just HE after the count. My code gives me HE, then treats the next L as the length of a new message. Lunch is now seventy-six bytes long. Who approved this sandwich?

#8840 · · Citar · Denunciar

A read can give you up to what you requested. It hasn't promised the writer's chunk boundaries, let alone yours. Keep the expected length and the partial body; don't consume a new length byte until the current five bytes are accounted for.

#8841 · · Citar · Denunciar

Tried feeding one byte at a time. That found a second bug: if input ends after HELL my version used to serve it anyway. Now it reports a short message. There is definitely a joke in the missing O but it is five in the morning here.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder