Forum: C++ Sep 21st, 2009 |
| Replies: 3 Views: 384 Post padding isn't the optimal solution. Pre-padding is!
Do a 32 bit write each write no loop!
unsigned char vect2enc[4][32];
uint32 *pAry = (uint32 *) vect2enc;
*(pAry+0) = 0;
*(pAry+1) =... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 good luck however if the server was written properly, the client is merely a playback. It can only request things of the server and its the servers job to validate a message, detect an invalid... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 You do not send (-) or 0 bytes! You need to only relay if bytes received is (> 0).
As to an error, you need to handle different errors appropriately. |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 Okay the Python code uses two threads. One deals with catching and relaying. The other the returned data.
The question now comes, which has been tickling at me, why are you trying to intercept... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 4,294,967,295
0xffffffff (-1)
Check the error!
Sounds like you don't have your second connection between proxy and Host established!
let's see your code again! |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 There are different socket type protocols. Do you know what protocol the source and destination sockets are communicating with? Based upon the data you're seeing it doesn't look encrypted!
You're... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 You are acting as a proxy and relaying packets. Do you have a message specification that describes the format of the messages? You can teach your program that format so it is more aware of what it is... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 You received a packet length, send the whole packet back! If their code is written properly they should be able to parse the bundled messages.
OR you know what the lead tag is, build a parser to... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 decimal value (0) is not a printable character! And negative characters are a problem.
The code has scrolled of the display but change
void printfunction( char * buffer, int size )
{
... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 Interesting. YOu have a fixed header,
contains
'S','A','M','P',127,0,0,1 ';', 5 Then a letter code
70 'p' contains four more bytes
69 'i'
63 'c'
72 'r' |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 If you have compile issues just modifiy this code block or remove it!
#if 0
if ( NULL != szText ) { char buff[ LOG_BUF_MAX ]; va_list args; va_start( args, szText ); vsprintf(buff, szText,... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 You are printing decimal codes for 127 0 0 1.
That normally isn't sent as a message! So either something is wrong with the sender, or those particular bytes are suppose to have the IP address within... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 This is a handy function to keep around. I have it embedded in my file logging system.
Use it to dump your incoming buffer.
I've twiddled it for the post and replace RawPrint as your cout or... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 Do you have a raw dump of what's being sent!
Did you catch my last second buffer posting of 1024 vs 10240.
)(127)(0)(0)(1)
127.0.0.1
Is someone sending the Local IP as text! |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 1st check that buffer length!
int fromlen = 10240; Your buffer is char buff[ 1024 ] not 10240.
that shouldn't be your problem but it is a problem!
Do a zero check!
Returning a vaue of zero... |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 Yes! That's the number of bytes received in the packet. Packets aren't cut in half, they are delivered whole! So your packet will contain one or more messages! |
Forum: C++ Aug 12th, 2009 |
| Replies: 50 Views: 1,790 I think you're all missing the point. Sockets doesn't send immediately.
Send Packet 5
Send Packet 8
Send Packet 7
It won't necessarily arrive as three packets 5 then 8 then 7 bytes in... |
Forum: C++ Aug 12th, 2009 |
| Replies: 3 Views: 1,370 Yes. bool was added to the C++ specification in a later release.
However bool is a loose specification within Visual Studio. It allows you to assign other values then bool true false. If I'm... |
Forum: C++ Aug 10th, 2009 |
| Replies: 3 Views: 269 Easy, End of File condition. Bytes may be in the buffer but an EOF occured.
Make sure the last line doesn't have the EOF! Or special handling. |
Forum: C++ Aug 10th, 2009 |
| Replies: 4 Views: 263 Pawns only go forward. if they aren't in their home row, they've moved!
if that's a problem, put a move counter on them.
If count=0, they haven't moved. Even a bit will do the job! |
Forum: C++ Aug 10th, 2009 |
| Replies: 6 Views: 891 You appear to need unique numbers but you are generating non-unique numbers.
You have a 2x4, unique numbers in the upper 2x2 and another unique set in the lower unique 2x2. So generate the top... |
Forum: C++ Aug 9th, 2009 |
| Replies: 5 Views: 268 else if (a==Y||y)
What exactly are you trying to do?
else if (a == 1 ) ???
You really need more description of what you're trying to do!
R,G,Y, r,g,y aren't even initialized! |
Forum: C++ Aug 8th, 2009 |
| Replies: 9 Views: 293 How about using bit history!
unsigned int nBits, b;
int r;
srand( time(NULL) );
nBits = 0;
while (nBits != (1 << 16)-1 )
{ |
Forum: C++ Aug 6th, 2009 |
| Replies: 13 Views: 468 I just ran vc8 which I have but don't use.
Menu: Project
SubMenu: Properties (last sub-menu item)
C/C++
Code Generation
Click on it
Runtime Library
Click on 2nd column then look at... |
Forum: C++ Aug 6th, 2009 |
| Replies: 13 Views: 468 Doesn't work that way.
Find your application configuration. Find the multi-threaded single-threaded and make sure it is what you expected! |
Forum: C++ Aug 6th, 2009 |
| Replies: 13 Views: 468 Multi-threaded application?
Project - Properties
Configuration Properties
Code Generation
DEBUG Configuration
Make sure it is Multi-threaded Debug /MTd NOT
Multi-threaded... |
Forum: C++ Aug 6th, 2009 |
| Replies: 13 Views: 468 Sounds like time for a re-install. 32-bit Visual Studio should be building 32-bit applications.
Does it run in the debugger but not when just running the exe? |
Forum: C++ Aug 6th, 2009 |
| Replies: 13 Views: 468 Are you running Visual Studio 2008 64-bit version? If so, does it actually build 32-bit versions, or only 64-bit! (As 64-bit code will not run on Win32!) |
Forum: C++ Aug 2nd, 2009 |
| Replies: 9 Views: 284 This is amazing. You're told your problems and you still ignore us.
One last attempt and you're on your own.
I've reformatted your code like you were told to do!
int main ()
{
int DOB... |
Forum: C++ Aug 2nd, 2009 |
| Replies: 9 Views: 284 Reformat, properly indent, and maybe you'll see your own problem.
Your i loop!
for (int i=0; i<12; i++)
WHAT 12 ?
Then you're using n and i for reference
What n? |
Forum: C++ Aug 2nd, 2009 |
| Replies: 9 Views: 284 Do you realize you have 11 ages.
You have three fixed arrays 10 elements in size
but you are dynamically allocating number of people, entering them, then deleting the array without doing anything... |
Forum: C++ Jul 31st, 2009 |
| Replies: 7 Views: 326 They you're not reading my entire post!
It explains proper use of srand()
Gives you the shuffle algorithm you indicated you needed. |
Forum: C++ Jul 31st, 2009 |
| Replies: 5 Views: 344 I certainly hope you don't have an srand before each rand!
Because that's a problem!
srand((unsigned) time(0)); <-- Stick me at top of program ONLY
int cus_num=rand()%4,
What time is... |
Forum: C++ Jul 31st, 2009 |
| Replies: 7 Views: 326 This definitely sounds like a homework assignment!
Key here is you said lottery game.
So sounds like you need a card shuffle algorithm for a deck of 49 cards, but you're only going to draw the... |
Forum: C++ Jul 31st, 2009 |
| Replies: 13 Views: 579 The computer merely sees a sequence of ones and zeros of a particlar sized grouping of bits.
For example 8-bit
10100101 Binary This is considered base 2
But that number can be... |
Forum: C++ Jul 30th, 2009 |
| Replies: 3 Views: 218 It depends on your keyboard.
it is not an absolute symbol, it is called a pipe.
if you look carefully it's a dashed line, not a solid one!
It is a conditional <OR>. A logical OR is as follows...... |
Forum: C++ Jul 30th, 2009 |
| Replies: 13 Views: 579 Okay so I missed the closing brace since it was late when I posted it.
{I'm not sure if the other postings were meant for me, but just in-case!}
As to the NULL terminator, my function didn't... |
Forum: C++ Jul 29th, 2009 |
| Replies: 13 Views: 579 How about reversing in place
void reverse(char *wordPtr)
{
char c, *dstPtr;
dstPtr = wordPtr + strlen( wordPtr ) - 1;
while (wordPtr < dstPtr)
{
c = *wordPtr; |
Forum: C++ Jul 25th, 2009 |
| Replies: 1 Views: 232 Are you trying to send the entire array or one element?
Sockets deal in chars!
int ary[100];
// send one integer in the array
send( hSock, (char *)&ary[3], sizeof(int), 0 );
If sending the... |
Forum: C++ Jul 22nd, 2009 |
| Replies: 10 Views: 370 Sorry can't do that.
Do this in two steps. Between your data entry loop and your data print loop.
for i = 0 to N - 1;
if ary[i] > ary[i+1] then swap those two!
loop until i is N - 2 so... |