This program is a server program which reads only one request at a time from a client. More...
#include <mysql/mysql.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
Go to the source code of this file.
Functions | |
void | print_all_records () |
This function will fetch all IDs tom populate the combo box at client interface. | |
void | modifyrecord () |
It is used to modify any record on the basis of product ID. | |
void | delete_record () |
It is used to delete a record of given ID from the product_info. | |
void | fetch_record () |
It is used to fetch a record of given ID from the database. | |
void | store_record () |
It is used to insert a new record in the database. | |
void | close_properly (int signal) |
It is used to close the server properly. | |
int | main (int argc, char *argv[]) |
It is main where program execution begins. | |
Variables | |
int | ID |
char | DESCRIPTION [100] |
float | RATE |
int | QUANTITY |
char | UOM [100] |
char | CATEGORY [100] |
char | buffer [1024] |
SERVER. | |
char | insert [1024] |
char | rev [6][200] |
char | retrieve [1000] |
int | listen_file_descriptor |
char | arr [1000][10] |
char | buf [4096] |
char | username [50] |
char | password [20] |
char | id [10] |
unsigned int | key |
unsigned int | count |
This program is a server program which reads only one request at a time from a client.
The program uses mysql as database. It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky. We will not use any signals in this program to keep it simple. This program sends the data from datbase to requesting client.
Definition in file server.c.
void close_properly | ( | int | signal | ) |
It is used to close the server properly.
signal | int value. |
Definition at line 55 of file server.c.
References listen_file_descriptor.
Referenced by main().
void delete_record | ( | ) |
void fetch_record | ( | ) |
It is used to fetch a record of given ID from the database.
It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky.
Definition at line 424 of file server.c.
References buffer, CATEGORY, ID, key, and rev.
Referenced by main().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
It is main where program execution begins.
argc | number of arguments paased. | |
argv | the argument passed from command line we pass port number as argument. |
Definition at line 73 of file server.c.
References arr, buf, buffer, ch, close_properly(), count, delete_record(), fetch_record(), insert, key, listen_file_descriptor, modifyrecord(), print_all_records(), retrieve, rev, and store_record().
void modifyrecord | ( | ) |
It is used to modify any record on the basis of product ID.
It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky.
Definition at line 302 of file server.c.
References buffer, CATEGORY, DESCRIPTION, ID, QUANTITY, RATE, and UOM.
Referenced by main().
void print_all_records | ( | ) |
void store_record | ( | ) |
It is used to insert a new record in the database.
The input given in text entries must not contain spaces. It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky.
Definition at line 364 of file server.c.
References CATEGORY, DESCRIPTION, ID, insert, QUANTITY, RATE, and UOM.
Referenced by main().
char arr[1000][10] |
Definition at line 43 of file server.c.
Referenced by main(), and print_all_records().
char buffer[1024] |
SERVER.
Definition at line 32 of file server.c.
Referenced by fetch_record(), main(), and modifyrecord().
char CATEGORY[100] |
Definition at line 30 of file server.c.
Referenced by fetch_record(), modifyrecord(), and store_record().
char DESCRIPTION[100] |
Definition at line 26 of file server.c.
Referenced by modifyrecord(), and store_record().
int ID |
Definition at line 25 of file server.c.
Referenced by fetch_record(), modifyrecord(), and store_record().
char insert[1024] |
Definition at line 33 of file server.c.
Referenced by main(), and store_record().
unsigned int key |
Definition at line 48 of file server.c.
Referenced by fetch_record(), and main().
Definition at line 36 of file server.c.
Referenced by close_properly(), and main().
int QUANTITY |
Definition at line 28 of file server.c.
Referenced by modifyrecord(), and store_record().
float RATE |
Definition at line 27 of file server.c.
Referenced by modifyrecord(), and store_record().
char rev[6][200] |
Definition at line 34 of file server.c.
Referenced by fetch_record(), and main().
char UOM[100] |
Definition at line 29 of file server.c.
Referenced by modifyrecord(), and store_record().