Question: Youll have to research the socket Java API. Have the server support two clients. #include #include #include #include #include #include /* for fork) /* /*

Youll have to research the socket Java API. Have the server supporttwo clients. #include #include #include #include #include #include /* for fork) /*Youll have to research the socket Java API. Have the server support two clients.

#include #include #include #include #include #include /* for fork) /* /* for errno/ /* for printf)* /* for exit) * /*for strcpy) for socket () */ #define SOCKETNAME "my-socket" int main(int argc, char **argv) /*bind won' t reuse an existing name/ (void unlink(SOCKETNAME); /*allocates memory space for a struct sockaddr struct sockaddr *sa-(struct sockaddr *)malloc (sizeof (struct sockaddr)) /* assigns "AF_UNIX" domain to the sa_family field / sa->sa family-AF UNIX strcpy (sa->sa_data, sOCKETNAME) /* declare a socket descriptor for the client/ int fd_client; int fd serverl, fd server2; if ( fork ( )--0 ) /*child-client* char buf[100] int err; /*returns a socket descriptor for the client/ printf("fd-client sleep (2); 2d ", fd-client); struct sockaddr sa sizeof (struct sockaddr): write(fd client, "Hello!", 7) printf("Client wrote \"%s\" ", "Hello!")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!