Question: I am trying to create a three simple programs (two in C, one in Java) that will communicate over a network (a simple 'Hello world'

I am trying to create a three simple programs (two in C, one in Java) that will communicate over a network (a simple 'Hello world' message): a tcp-client in C, a tcp-client in java, and tcp-server in C. The programs must compile in a UNIX-based environment and execute system calls such as (but not limited to) socket(), bind(), gethostbyname(), gethostname(), read(), write(), send(), listen(), pthread_create(), pthread_detach(), getsockname(), and pthread_exit(), etc. For this inquiry, I am just interested in the server program although help with the client porgrams would be great as well. The server program must be able to accept multiple requests from clients and respond simultaneously. The server program (in C) will take a port number as an argument on the command line, used to bind the socket and recieve messages on the correct port; it will also create a server socket (not using auto-binding but the provided port number) for binding the socket. It then will wait for incoming requests from client programs. When a request is recieved, it should create a new detacthed thread used for interpreting the mesage by parsing. The messages recieved will be like html tags. For instance, if Hello is recieved, it will respond with the same message (only, say using the tag Hello). Other tags ultimately will be used and implemented but I am only interested in just getting the simple message echo to work. The child thread will then close the socket and terminate the connection. The main thread will continue to listen. Any implementation suggestions or help would be greatly appreciated.

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!