Find Jobs
Hire Freelancers

Client server program - Unix Network programming

$10-30 USD

Zamknięte
Opublikowano około 9 lat temu

$10-30 USD

Płatne przy odbiorze
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
Identyfikator projektu: 7205808

Informację o projekcie

2 ofert
Zdalny projekt
Aktywny 9 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne
2 freelancerzy składają oferty o średniej wysokości $300 USD dla tej pracy
Awatar Użytkownika
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 w 5 dni
5,0 (3 opinii)
3,1
3,1
Awatar Użytkownika
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 w 10 dni
0,0 (0 opinii)
0,0
0,0

O kliencie

Flaga UNITED STATES
DeKalb, United States
0,0
0
Członek od paź 13, 2014

Weryfikacja Klienta

Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.