5 Replies - 288 Views - Last Post: 25 May 2018 - 06:11 AM Rate Topic: -----

#1 johnsvici   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 18

Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 04:16 AM

Hi! I have to make a tiny webserver in C in Unix. I have the first part of the code given by my teacher, and i have to add some extra tasks to it . I dont know why when i compile my code i have some errors. I post now the codes:
1. teacher's first part of the code
Spoiler


Tasks:

Spoiler

Spoiler

Spoiler


My new code made with my colleague's help:
Spoiler


IF somebody has any ideeas how to solve this i am waiting for it !
Thanks !!!

Is This A Good Question/Topic? 0
  • +

Replies To: Help - Tiny webserver C in UNIX . TCPIP - big problem

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6659
  • View blog
  • Posts: 30,977
  • Joined: 10-May 07

Re: Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 04:35 AM

Can you post the errors that you are getting, along with any arguments that you are supplying to make? Thank you.
Was This Post Helpful? 0
  • +
  • -

#3 johnsvici   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 18

Re: Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 05:19 AM

View Postno2pencil, on 25 May 2018 - 04:35 AM, said:

Can you post the errors that you are getting, along with any arguments that you are supplying to make? Thank you.

sure, i have to say that i am not that good in programming..
Posted Image
Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg   User is offline

  • member icon

Reputation: 5537
  • View blog
  • Posts: 17,144
  • Joined: 25-December 09

Re: Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 05:40 AM

Please post cut and paste the errors into a post, pictures are difficult to read.

Also posted here.

Jim
Was This Post Helpful? 2
  • +
  • -

#5 johnsvici   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 18

Re: Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 05:53 AM

View Postjimblumberg, on 25 May 2018 - 05:40 AM, said:

Please post cut and paste the errors into a post, pictures are difficult to read.

Also posted here.

Jim


Yes, sorry for multi posting but the i have my deadline soon and i can't find the solution for it .. here s the error in the terminal
[email protected]:~/bun$ gcc -o novo novo.c
novo.c: In function ‘handle_request’:
novo.c:94:2: warning: implicit declaration of function ‘waitpid’; did you mean ‘getpid’? [-Wimplicit-function-declaration]
  waitpid(-1,&status,WNOHANG);
  ^~~~~~~
  getpid
novo.c: In function ‘openFile’:
novo.c:123:3: warning: implicit declaration of function ‘sendfile’; did you mean ‘readFile’? [-Wimplicit-function-declaration]
   sendfile(client_socket, fdimg, NULL, 4000);
   ^~~~~~~~
   readFile
[email protected]:~/bun$

Was This Post Helpful? 0
  • +
  • -

#6 jimblumberg   User is offline

  • member icon

Reputation: 5537
  • View blog
  • Posts: 17,144
  • Joined: 25-December 09

Re: Help - Tiny webserver C in UNIX . TCPIP - big problem

Posted 25 May 2018 - 06:11 AM

Do you know what "implicit declaration" means? Did you look up the documentation for those functions?

Also you really should be compiling with at least the following switches "-g -Wall -Wextra -Wvla" and I usually recommend the following as well: "-pedantic -pedantic-errors" and be sure to specify the standard you wish to use to compile this code, -std=c90 -std=c99 -std=c11 (this is the most recent C standard).

I really suggest using C11 with all the switches I suggested.


Jim
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1