This is the function that sends the message to the client:
void send_file(int remotefd, char file_addr[], int http_subver){
char *file;
char buf[FILE_BUF_SIZE + 60];
...
Type: Posts; User: rikehmmc
This is the function that sends the message to the client:
void send_file(int remotefd, char file_addr[], int http_subver){
char *file;
char buf[FILE_BUF_SIZE + 60];
...
Also the FILE_BUF_SIZE is currently set as 10k. The png I am trying to send is 3.5k, so there should be no problem there
I'm trying to do a small web server. I want this server to send a png.
The client browser sends the request:
GET /someimage.png HTTP/1.1
loads of information I don't care about
I think I may have found the problem. The last argument of accept must be an initialized pointer to int. Thank you anduril462 ;)
The mutex will be used when I have multiple threads accepting from...
This is the code to run in the server. It is supposed to receive requests on port 8080. To test it I use that client.
Hi, so I'm doing this code for a server.
It is supposed to receive a message and answer it. I have code doing it successfuly, it was all in main and not really readable. I divided it in functions...
Yes, but how do i use that in other header file? On the code file I just write #include "trees.h", however on the header file list.h it does not seem to work
True, true...
What about the using the less pointer in other header files? It was defined this way
int (*less) (Item, Item);
I just want to hide what is in the structure. And what do i do to use the less pointer in this function, that is used on list.c:
void insert_in_list(NODE * list, NODE * new_node, int (*less)...
I also want to use the less pointer in my list header file. How do I do that?
What if I want to hide the structure definition in the original header file? This one:
typedef struct NODE{
Item * item;
struct NODE * right;
struct NODE * left;
}NODE;
If i want to use this declaration of NODE in another .c file i just need to include tree.h. But on the header file it does not work. What do I do?
LOL. "Those dark ages...". well, my teacher taught me to cast a malloc and a calloc, I guess he lived in that awful time where people had to open brackets, write one word, maybe a little shiny star,...
Thanks. So i modified this line
node->item = (Item*) calloc (strlen(word) +1, sizeof (char));
and created the function
int less_alphabetic (Item item1, Item item2){
This is in a function that creates a tree data base of words
NODE * create_dictionary(FILE * fp){
char * word ;
NODE * tree;
NODE * aux;
tree = create_tree();
But when the string is allocated I already do the cast of the item in that structure to char *. Or it doesn't work this way?
Now it's working, Thanks.
How do I do a right casting of item? I did something like this
item = (char*) malloc (sizeof (my_string));
The debugger says it is an assignment form incompatible...
It worked! Thank you =D
New problem :/ im doing now a function that balances the tree when inserting. The debugger says "Dereferencing pointer to incomplete type" because of this:
NODE *...
I am trying to do some functions to manage trees that receive has argument pointers to functions.
Item is declared like this:
typedef void * Item;
There is a structure called NODE: