Find Jobs
Hire Freelancers

Client server program - Unix Network programming

$10-30 USD

Cerrado
Publicado hace alrededor de 9 años

$10-30 USD

Pagado a la entrega
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 del proyecto: 7205808

Información sobre el proyecto

2 propuestas
Proyecto remoto
Activo hace 9 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
2 freelancers están ofertando un promedio de $300 USD por este trabajo
Avatar del usuario
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 en 5 días
5,0 (3 comentarios)
3,1
3,1
Avatar del usuario
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 en 10 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
DeKalb, United States
0,0
0
Miembro desde oct 13, 2014

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.