100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
gfserver.c - Georgia Institute Of Technology OMSCS 6200 $8.99   Add to cart

Exam (elaborations)

gfserver.c - Georgia Institute Of Technology OMSCS 6200

 103 views  0 purchase
  • Course
  • Institution

#include "gfserver-student.h" /* * Modify this file to implement the interface specified in * gfserver.h. */ typedef struct gfserver_t { unsigned short port; int max_pending; gfh_error_t (*handler)(gfcontext_t **, const char *, void *); void *arg; } gfserver_t; typedef struct gfc...

[Show more]

Preview 1 out of 4  pages

  • February 11, 2023
  • 4
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
#include "gfserver-student.h"

/*
* Modify this file to implement the interface specified in
* gfserver.h.
*/

typedef struct gfserver_t
{
unsigned short port;
int max_pending;
gfh_error_t (*handler)(gfcontext_t **, const char *, void *);
void *arg;
} gfserver_t;

typedef struct gfcontext_t
{
int client_socket_fd;
char *file_path;
} gfcontext_t;

void gfs_abort(gfcontext_t **ctx)
{
close((*ctx)->client_socket_fd);
free(*ctx);
*ctx = NULL;
}

gfserver_t *gfserver_create()
{
gfserver_t *gfs;
if ((gfs = (gfserver_t *)malloc(sizeof(gfserver_t))) == NULL)
{
perror("Cannot malloc gfsever_t");
exit(-1);
}
return gfs;
}

ssize_t gfs_send(gfcontext_t **ctx, const void *data, size_t len)
{
return send((*ctx)->client_socket_fd, data, len, 0);
}

ssize_t gfs_sendheader(gfcontext_t **ctx, gfstatus_t status, size_t file_len)
{
char header_buffer[BUFFER_SIZE];
char *status_str;

if (status == GF_FILE_NOT_FOUND)
{
status_str = "FILE_NOT_FOUND";
}
else if (status == GF_INVALID)
{
status_str = "INVALID";
}
else
{
status_str = "ERROR";
}

if (status == GF_OK)

This study source was downloaded by 100000850872992 from CourseHero.com on 02-11-2023 00:23:23 GMT -06:00


https://www.coursehero.com/file/71298649/gfserverc/

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ExamsConnoisseur. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $8.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

85443 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$8.99
  • (0)
  Add to cart