does anyone know anything about socket programming using C.
i hav this project i hav to do n i need desperate help. i dont know how to start this project, can any1 giv me hints or better yet a solution. it wuld b very much appreciated.
the project is the following:
program must be written in ‘C’ using TCP/IPv4 sockets, and must run on any
machines in the Department labs.
2. The concurrent server creates a new process for each connecting client.
3. The server accepts the following command line parameters:
• max_wait_time (1 to 30 seconds): If a child process does not receive any
request (from its client) within a max_wait_time, the child process
disconnects the client, and terminates.
• printer_speed (10 to 500 bytes per second): Used to simulate the printing time.
• max_print (5 to 20 requests): The size of a printer_queue.
For example, the server is run as: server 10 100 6
4. The client should show a command prompt “client>” while waiting for a
command from the user.
5. Consider two printers: P1 and P2, each of which is simulated by a process. Assume
that the two printers have the same printer_speed and max_print. To simulate a
printing of a file of size x bytes, the process P1, for example, sleeps for
6. The server should maintain the following items.
a. A P1_queue and a P2_queue of size max_print each. The P1_queue keeps all
user print-requests waiting for printer P1, and the P2_queue keeps those for printer
P2. Each print-request in the queues should contain the following information:
• request_no (a unique positive integer starting from 1).
• owner of the request (Use the IP address of the client).
Two directories P1_job and P2_job that keeps all the files waiting to be printed by
P1 and P2, respectively.
c. Two directories, P1_printout and P2_printout, each keeps all the files that have
been printed by P1 and P2, respectively. (To simulate the hard copies from the
d. A P1_statistic and a P2_statistic that maintain the details of what printer jobs that
have been executed by P1 and P2, respectively. Included in the details are the
information of the print-request, e.g., request_no, owner of the request, filename,
size of the file, and priority. In addition, the statistic includes the time each file
was printed and its printing order (e.g., #1, #2, etc.).
7. The server/client recognizes the following user requests/commands (note
that printer can be either P1 or P2):
a. lpr_ -pprinter filename priority:
• The client should send the file filename to the server. Note, the file can be
of any types (a text file or a binary file).
• If the P1_queue for P1, for example, is full, the request should be rejected,
and the requesting party (client) should be notified.
• If the request is accepted, the server should reply with a unique request_no for
the request, put the file filename in its corresponding printer job (e.g.,
P1_job) directory, and update its corresponding printer queue (e.g.,
b. lpq_ -pprinter: The server sends to the client contents of the printer queue
for printer (e.g., P1_queue).
c. lprm_ –pprinter request_no: The server should check if the requesting
client is the owner of the print request. If it is, the server should delete the request
from the corresponding printer queue (e.g., P1_queue), delete the file from the
corresponding printer job (e.g., P1_job), and let the client know that the request
with ID request_no has been removed. Otherwise, send an appropriate error
message to the requesting client.
d. lpstat_ -pprinter: The server sends to the client the contents of the printer
statistic of printer
e. exit_:A user/client terminates the connection session with the server.