Find Jobs
Hire Freelancers

Client server program - Unix Network programming

$10-30 USD

Closed
Posted about 9 years ago

$10-30 USD

Paid on delivery
Implement your client application according to the following usage statement: Usage: prog2_client <IP‐number> [<port‐number>] As such the IP number to connect to is required and the port number is optional. The default port number shall be 9880. Note: It is implied that the socket used to connect to the server will be opened once and then used to send zero or more queries. You will provide your own version of in_out.c that will provide implementations of writen() and readline() as discussed in the UNP text. These functions should be taken from UNP section 3.9. You will replace the #include "unp.h" with the appropriate system header files as demonstrated in class. You can save typing time by downloading the UNP book source code as shown in class and extracting the functions from the following files: lib/writen.c lib/readline.c prog2_client.c In this file, place your main() and usage() functions. It will parse the command line arguments, open a socket to the server, execute a loop that will prompt the user for book title, call a doQuery() function described below for each title, print the returned author message and ultimately close() the socket when there are no more titles. query.c The business logic for your client must be implemented in a function whose declaration shall be: int doQuery(int sock, const char *title, char *author, size_t authorlen); This function will send a newline‐terminated (\n) text string given in title, read a text string into author that is no longer than authorlen until it reaches a newline or EOF and prune off any junk whitespace (see isspace(3)) from the end of the response. The proper way to pass the title to this function is to send it a string that has no leading or trailing whitespace. As discussed in the manual page, things like fgets() may or may not include a trailing newline in the text string that it reads. Therefore you must trim any off that are present before passing it as the title to your doQuery() function. It is required that the title text string sent to the server include a trailing \n character. The proper way to address this requirement is to add it in the doQuery() function before calling writen() OR you can call writen() to send the title string WITHOUT a trailing null character and THEN call it again to send a single \n character. Yes. This means that your main function will remove any \n if one is present from the user input and then doQuery() will add one back on again. This may seem odd but it is the most sensible thing to do since 1) fgets(3) is inconsistent and 2) providing a function to look up an author from a title should do just that and not require the caller to pass it a title with a \n on the end of it. query.h Function declarations and public information for query.c wrapper.c Your system call wrappers go here. wrapper.h Function declarations and public information for wrapper.c. in_out.c Source code of writen() and readline(). in_out.h
Project ID: 7205808

About the project

2 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
2 freelancers are bidding on average $300 USD for this job
User Avatar
Hi. We are a group of experienced engineers with different backgrounds (telecommunications, electronics and systems) with experience in technologies like C/C++/C#/Java/J2EE/Linux/Scripting/SQL, who work for a telecommunications company. Along these years we have worked mainly with embedded systems, for example, high availability communications servers and cable modems. Since we have experience implementing networking applications in both Windows and Linux environments we think that we are suitable for this job. Best regards, Matias.-
$100 USD in 5 days
5.0 (3 reviews)
3.1
3.1
User Avatar
We're an American firm based in Midwest Nebraska. Everyone in the firm is native to the USA and speaks/types fluent English so communication will not be a problem. We'll also respect your time, as the longer something takes to complete the longer our resources are tied up as well. This is not to say we will rush, but when you send us a message or some form of communication we will get back to you ASAP.
$500 USD in 10 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
DeKalb, United States
0.0
0
Member since Oct 13, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.