#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <gtk/gtk.h>
Go to the source code of this file.
Defines | |
#define | BUFFER 4096 |
#define | SERVER_PORT 8000 |
Functions | |
gint | closewin (GtkWidget *widget, GdkEvent *event, gpointer data) |
Properly ends the GTK program. | |
void | button1 (GtkWidget *widget1, gpointer data) |
Radio button handler for button1. | |
void | button2 (GtkWidget *widget1, gpointer data) |
Radio button handler for button2. | |
void | button3 (GtkWidget *widget1, gpointer data) |
Radio button handler for button3. | |
void | button4 (GtkWidget *widget1, gpointer data) |
Radio button handler for button4. | |
void | question (char *) |
int | submit (GtkWidget *wid, gpointer data) |
Processes the answer provided by the client. | |
void | endexam (int score, int total) |
Prints the final score when exam is ended, Prints an error message if exam is ended abruptly. | |
void | question (char que[]) |
Parses the question and prints it in a GUI window using GTK. | |
int | main (int argc, char *argv[]) |
Used to connect to the exam server and recieve the questions. | |
Variables | |
int | read_desc |
int | write_desc |
gboolean | radio1 = TRUE |
gboolean | radio2 = FALSE |
gboolean | radio3 = FALSE |
gboolean | radio4 = FALSE |
GtkWidget * | window |
GtkWidget * | group |
GtkWidget * | label1 |
GtkWidget * | rad1 |
GtkWidget * | rad2 |
GtkWidget * | rad3 |
GtkWidget * | rad4 |
GtkWidget * | box |
GtkWidget * | button5 |
#define BUFFER 4096 |
#define SERVER_PORT 8000 |
void button1 | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
Radio button handler for button1.
widget1 | GTKWidget | |
data | gpointer object |
Definition at line 188 of file examclient.c.
References radio1.
Referenced by question().
void button2 | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
Radio button handler for button2.
widget1 | GTKWidget | |
data | gpointer object |
Definition at line 203 of file examclient.c.
References radio2.
Referenced by question().
void button3 | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
Radio button handler for button3.
widget1 | GTKWidget | |
data | gpointer object |
Definition at line 218 of file examclient.c.
References radio3.
Referenced by question().
void button4 | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
Radio button handler for button4.
widget1 | GTKWidget | |
data | gpointer object |
Definition at line 233 of file examclient.c.
References radio4.
Referenced by question().
gint closewin | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) |
Properly ends the GTK program.
widget | GTKWidget | |
event | Event handling | |
data | data object |
Definition at line 22 of file examclient.c.
Referenced by main(), and question().
void endexam | ( | int | score, | |
int | total | |||
) |
Prints the final score when exam is ended, Prints an error message if exam is ended abruptly.
score | final score | |
total | total marks |
Definition at line 166 of file examclient.c.
Referenced by main(), question(), and submit().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Used to connect to the exam server and recieve the questions.
The questions are displayed in GTK window. It then send the answers. The client connects to the server using an IP address provided to it through command line. It uses the server port 8000 to connect to the server.
argc | number of command line arguments passed to the program including program name itself. | |
argv | array of command line arguments. |
Definition at line 252 of file examclient.c.
References BUFFER, closewin(), endexam(), question(), SERVER_PORT, window, and write_desc.
void question | ( | char | que[] | ) |
Parses the question and prints it in a GUI window using GTK.
que | takes a question in string. Options Separated by | |
Definition at line 47 of file examclient.c.
References box, BUFFER, button1(), button2(), button3(), button4(), button5, closewin(), endexam(), group, label1, rad1, rad2, rad3, rad4, submit(), and window.
int submit | ( | GtkWidget * | wid, | |
gpointer | data | |||
) |
Processes the answer provided by the client.
wid | GTKWidget | |
data | gpointer |
Definition at line 122 of file examclient.c.
References box, BUFFER, endexam(), question(), radio1, radio2, radio3, radio4, window, and write_desc.
Referenced by question().
GtkWidget * box |
GtkWidget * button5 |
GtkWidget * group |
GtkWidget* label1 |
GtkWidget * rad1 |
GtkWidget * rad2 |
GtkWidget * rad3 |
GtkWidget * rad4 |
gboolean radio1 = TRUE |
gboolean radio2 = FALSE |
gboolean radio3 = FALSE |
gboolean radio4 = FALSE |
int read_desc |
Definition at line 36 of file examclient.c.
GtkWidget* window |
int write_desc |