Fixed error in compilation
This commit is contained in:
parent
c302bed499
commit
44fb3aa66e
@ -43,6 +43,7 @@
|
|||||||
#include <netinet/in.h> //
|
#include <netinet/in.h> //
|
||||||
#include <sys/socket.h> //
|
#include <sys/socket.h> //
|
||||||
#include <arpa/inet.h> //
|
#include <arpa/inet.h> //
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ int main(void)
|
|||||||
unsigned int client_s; // Client socket descriptor
|
unsigned int client_s; // Client socket descriptor
|
||||||
struct sockaddr_in client_addr; // Client Internet address
|
struct sockaddr_in client_addr; // Client Internet address
|
||||||
struct in_addr client_ip_addr; // Client IP address
|
struct in_addr client_ip_addr; // Client IP address
|
||||||
int addr_len; // Internet address length
|
socklen_t addr_len; // Internet address length
|
||||||
|
|
||||||
/* FOR UNIX/LINUX ------------------------------------------------------ */
|
/* FOR UNIX/LINUX ------------------------------------------------------ */
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
@ -118,7 +119,7 @@ int main(void)
|
|||||||
// Main loop to listen, accept, and then spin-off a thread to handle the GET
|
// Main loop to listen, accept, and then spin-off a thread to handle the GET
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
// Listen for connections and then accept
|
// Listen for connections and then accept
|
||||||
listen(server_s, 100);
|
listen(server_s, 100);
|
||||||
addr_len = sizeof(client_addr);
|
addr_len = sizeof(client_addr);
|
||||||
|
|
||||||
@ -135,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 == -1) // if I am a new child, go to the child module.
|
if (nChild_proc_id == 0) // if I am a new child, go to the child module.
|
||||||
{
|
{
|
||||||
child_proc(server_s, client_s);
|
child_proc(server_s, client_s);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user