I want to modify certain outgoing packets from my Windows XP box. What would be the easiest way to do this?
(e.g. if the dest.port == 2500, then slap on another TCP/IP header with dest.port==25 and dest.ip==11.22.33.44 -- encapsulation or IP tunneling, I guess)
I tried finding a program or...
Update: I have just found that if I change my client to loop on the recv() call, it will receive numerous packets, but the server will send the whole thing with only one call to send(). Has send() been changed to always send the entire thing in a single call?
Can anyone help me out? I wrote test server/client programs to see how send and recv worked, and they work how I'd expect them to. (when trying to send() a large packet, it will only send part of it) However, if I try to use telnet/internet explorer as the client instead, send() will send a...
Now wait a minute. In Windows, if I am reading a file, am I going to need to use "\r\n" to represent a newline character? I thought that C would merge them together (to keep programs portable) into a single '\n' character. Is this wrong? Here's why I am thinking this way:
"As...
OK, here's my program.
#include <stdio.h>
#include <string.h>
void minprintf(char *fmt, ...);
/* prints a few lines of output, to test minprintf */
int main()
{
int i = 321;
double ld = 43.5939232223;
char s[] = "The quick brown fox jumps over the lazy dog."...
"An array name in an expression is treated by the compiler as a pointer to the first element of the array"
Hmmm... So, are you saying that the array variable (the pointer to the first element of the array) isn't an actual variable when the program is run? (the compiler would...
Oh Lim, I think that sizeof 'A' returns 4 because 'A' is really a pointer to the character constant A. Kind of like how you can have a function:
char blah(char *s)
{
return *s
}
And call it with:
blah("Hi");
That is one of those things that I never REALLY understood, but I'm...
Okay, I'm sort of confused about how sizeof works. Can I really use sizeof anywhere in the program (except #if statements) just like it is a function, or something? All of the sizeof's are replaced by the actual size of the object, right? The reason I'm asking, is this program:
#include...
Are you saying that, when I define some array, it puts that array somewhere in the middle of some special "read/write" memory area, and I'll only get a segmentation fault if I try to access a memory location outside of that entire read/write memory area?
Heh, actually, I did set those two spots to output Hi. (s[-5] = 'H', s[400] = 'i';) And the *s = 0 not working is really what confused me. I would understand if s[-5] did not work also, but that does. And I can initialize the pointer *s with "Hi there", but cannot modify it...
Oh, well I do get Segmentation Faults when I try to modify anything related to *s. However, if I use the array s[], I don't get them. (I can make a negative index, or just an index larger than the array was defined, and it won't give me any error) I just tested this again:
char s[25];
s[-5]...
Does anyone know exactly what happens when you define an array? I'm asking this, because (in Linux) I don't always get Segmentation Faults, when I would normally expect one. For example:
char s[25];
s[400] = 0;
s[-5] = 0;
With that, I don't think that I got any errors running the program. I...
Here's an example of something that I wrote, to convert escape sequences in a string into the characters they represent. In the for loop, I stop whenever t[ti] != '\0'. Usually it will just increment ti by one at the end of an iteration, but if there is an escape sequence ("\t" or...
I am learning C now (using a book), after learning Pascal and Visual BASIC. (by taking classes on them) I'm wondering, is it normal to change the loop control variable of a for loop (in C) inside the loop? Is it generally considered bad style? Or, are there just certain situations where it is...
Does anyone here know of a good web-page that explains floating point numbers, and how they are stored, well? I just realized that I have absolutely no idea how they work, when I had started thinking about how I would be able to compute the range of them. =) (Yes, I know there's stuff in...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.