![]() |
Passing encrypted string through socket, weird behavior?
I am writing a client/server application, which involves the Blowfish cipher.
I have a problem, when I send encrypted data from the client to the server... It takes the content and reads up to a certain point then truncates it, sending the remaining data to another file. The data is: Quote:
ls -lastrb indicates there is a special character on this filename: 7.W6NIF.\012 Questions: 1) Is there a way in C++ to force the read of strings as literal, instead of being "processed". 2) Is there some character code that caused the split? The buffers appear to be fine. Why split at this position? 3) Why is there a \012 on the filename of the unwanted file? |
012 is the octal value for a line feed, could be the reason the transfer seems to be splitting.
Prior to sending and receiving the data, trim it. Make sure your buffer is large enough to hold the largest data expected. :
string Trim (string str) |
I doubt that your problem is with C++, per se. Octal 012 is a newline. I'm not surprised
to find one at the end. I suggest that your problem is in the handling. You don't say much about that (system, OS, mechanism being used to make the transfer, or write the file). You would have more luck interpreting the contents of your string if you looked at it in hexadecimal format. Those '.'s could be anything. If there's a Windows stream involved, and it's in default text mode, 0x1a will behave as an end-of-file indicator. Nice job blowing the width to hell just to preserve '.'s that aren't readable, anyway ;) . |
| All times are GMT -5. The time now is 1:31 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC