[Botan-devel] Sending raw, unencoded data over a network
Z. S. O.
tiredashell at gmail.com
Mon Apr 13 23:57:17 EDT 2009
After much searching, I figured out how to do it...but it's a bit "hacky."
Basically, I realized that although chars can't hold binary data, strings
and vectors can. So you basically have to make the buffer point to a vector
of chars as so:
char *buffer = &(myVector);
int len = recv(socket, buffer, 1024);
for (int i; i<len; i++)
data += myVector.at(i);
The string "data" will then hold the correct binary data. Hope this helps
anyone who runs into the same issue.
On Mon, Apr 13, 2009 at 8:04 PM, Jack Lloyd <lloyd at randombit.net> wrote:
> On Mon, Apr 13, 2009 at 03:23:14PM -0400, Z. S. O. wrote:
> > Yes, recv returns the actual data size, but that's after it has already
> > copied into the buffer. It looks like this:
> > int len = recv(socket, buffer, 1024);
> > So buffer already will only contain part of the data, and the rest is
> > presumably lost. I'm trying to ask this on a networking-oriented mailing
> > list because I don't want to bother you with off-topic questions, but if
> > have experience with this I'm open to any suggestions. Thanks.
> Nothing pops out to me. I think the first thing I'd try here is
> running tcpdump on the line and seeing if the packet on the wire
> contains the full contents or not. That at least cuts the problem
> space in half and you can know to dig further into the sender or the
> botan-devel mailing list
> botan-devel at randombit.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the botan-devel