server.c File Reference

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

Detailed Description

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.

Author:
Jogender Singh
Version:
1.0
Date:
5/4/2010

Definition in file server.c.


Function Documentation

void close_properly ( int  signal  ) 

It is used to close the server properly.

Parameters:
signal int value.
Returns:
void

Definition at line 55 of file server.c.

References listen_file_descriptor.

Referenced by main().

void delete_record (  ) 

It is used to delete a record of given ID from the product_info.

It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky.

Returns:
void

Definition at line 504 of file server.c.

Referenced by main().

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.

Returns:
void

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.

Parameters:
argc number of arguments paased.
argv the argument passed from command line we pass port number as argument.
Returns:
void

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.

Returns:
void

Definition at line 302 of file server.c.

References buffer, CATEGORY, DESCRIPTION, ID, QUANTITY, RATE, and UOM.

Referenced by main().

void print_all_records (  ) 

This function will fetch all IDs tom populate the combo box at client interface.

It is assumed that there exists a table named product_info in a database named Product with username as User and password as lucky.

Returns:
void

Definition at line 238 of file server.c.

References arr, and count.

Referenced by main().

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.

Returns:
void

Definition at line 364 of file server.c.

References CATEGORY, DESCRIPTION, ID, insert, QUANTITY, RATE, and UOM.

Referenced by main().


Variable Documentation

char arr[1000][10]

Definition at line 43 of file server.c.

Referenced by main(), and print_all_records().

char buf[4096]

Definition at line 44 of file server.c.

Referenced by main().

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().

unsigned int count

Definition at line 49 of file server.c.

char DESCRIPTION[100]

Definition at line 26 of file server.c.

Referenced by modifyrecord(), and store_record().

char id[10]

Definition at line 47 of file server.c.

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().

char password[20]

Definition at line 46 of file server.c.

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 retrieve[1000]

Definition at line 35 of file server.c.

Referenced by main().

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().

char username[50]

Definition at line 45 of file server.c.


Generated on Wed Apr 7 16:15:36 2010 for Departmental_Store_Inventory_Management by  doxygen 1.6.1