Hullo. I'm writing a simple server which will parse messages and respond to them. Since I do not usually work with c++, I'm looking for a little help![]()
My protocol is a simple one -- Command\rArgument\rArgument\n (or Command\n) but I'm having trouble parsing it. What I would like to do is set up a buffer which data is put into, and then complete commands are taken out/parsed and any leftover is returned to the buffer. Unfortunantly, I'm not too clear on how to do this :P
Here's what we're looking at:
any comments/code would be appreciated. Thanks.Code:char input[256]; memset(input,0x20, 255); input[255] = '\0'; while( sckout != SOCKET_ERROR ) { lenx = recv( sckout, input, sizeof(input), 0) ; if (lenx > 0) { /* ehhhhh :-D */ } } }



Reply With Quote