Find Jobs
Hire Freelancers

Client server program - Unix Network programming

$10-30 USD

クローズ
投稿日: 約9年前

$10-30 USD

完了時にお支払い
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
プロジェクト ID: 7205808

プロジェクトについて

2個の提案
リモートプロジェクト
アクティブ 9年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
この仕事に2人のフリーランサーが、平均$300 USDで入札しています
ユーザーアバター
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 5日以内
5.0 (3 レビュー)
3.1
3.1
ユーザーアバター
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 10日以内
0.0 (0 レビュー)
0.0
0.0

クライアントについて

UNITED STATESのフラグ
DeKalb, United States
0.0
0
メンバー登録日:10月 13, 2014

クライアント確認

このクライアントからの他の仕事

Client server program - open to bidding
$10-30 USD
ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。