Added proxy base and fixed web server #1
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
//----- Defines -------------------------------------------------------------
|
//----- Defines -------------------------------------------------------------
|
||||||
#define BUF_SIZE 4096 // Buffer size (big enough for a GET)
|
#define BUF_SIZE 4096 // Buffer size (big enough for a GET)
|
||||||
#define PORT_NUM 9080 // Port number for a Web server
|
#define PORT_NUM 7080 // Port number for a Web server
|
||||||
|
|
||||||
//----- Function prototypes -------------------------------------------------
|
//----- Function prototypes -------------------------------------------------
|
||||||
/* FOR WIN --------------------------------------------------------------- */
|
/* FOR WIN --------------------------------------------------------------- */
|
||||||
@ -136,7 +136,7 @@ int main(void)
|
|||||||
nChild_proc_id = fork();
|
nChild_proc_id = fork();
|
||||||
|
|
||||||
// Separate the parent and child process here ...
|
// Separate the parent and child process here ...
|
||||||
if (nChild_proc_id == 0) // if I am a new child, go to the child module.
|
if (nChild_proc_id == -1) // if I am a new child, go to the child module.
|
||||||
{
|
{
|
||||||
child_proc(server_s, client_s);
|
child_proc(server_s, client_s);
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ void child_proc(int server_s, int client_s)
|
|||||||
char *file_name; // File name
|
char *file_name; // File name
|
||||||
unsigned int fh; // File handle
|
unsigned int fh; // File handle
|
||||||
unsigned int buf_len; // Buffer length for file reads
|
unsigned int buf_len; // Buffer length for file reads
|
||||||
unsigned int retcode; // Return code
|
ssize_t retcode; // Return code
|
||||||
|
|
||||||
// Shut down the parent pipe
|
// Shut down the parent pipe
|
||||||
close(server_s);
|
close(server_s);
|
||||||
@ -300,6 +300,7 @@ void child_proc(int server_s, int client_s)
|
|||||||
|
|
||||||
// Shut down my (the child) pipe
|
// Shut down my (the child) pipe
|
||||||
close(client_s);
|
close(client_s);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user