Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

test001sockets.c File Reference

This program tests the low-level tcp-socket-stream library function. More...

#include <stdio.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <signal.h>
#include "../lib/libcomm.h"

Defines

#define PORT   1234
 Port on which the server is listening and the client trys to connect. More...

#define bufsize   8192
 How much random bytes should be transfered? More...


Functions

 main (int argc, char *argv[])
 test0001sockts: see test0001sockts.c. More...

 client_test_program (char *server, int port)
 test0001sockts: see test0001sockts.c, Client Test Programm. More...

 server_test_program (int port)
 test0001sockts: see test0001sockts.c, Server Test Programm. More...


Detailed Description

This program tests the low-level tcp-socket-stream library function.


Define Documentation

#define bufsize   8192
 

How much random bytes should be transfered?

#define PORT   1234
 

Port on which the server is listening and the client trys to connect.


Function Documentation

client_test_program char *    server,
int    port
 

test0001sockts: see test0001sockts.c, Client Test Programm.

The client test program generates a block of n*(bufsize) random bytes, sents theses bytes to the server, receive a block from server, invert it and compare it with generated block.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.

Parameters:
server  a string which contains the server name
port  an integer which specifies the port on the server

main int    argc,
char *    argv[]
 

test0001sockts: see test0001sockts.c.

server_test_program int    port
 

test0001sockts: see test0001sockts.c, Server Test Programm.

The server test program binds a port and waits for connections. If someone connects it reads n*(bufsize) bytes, invert all bits of these bytes and send all back.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.

Parameters:
port  an integer which specifies the port to bind.


Generated on Mon Apr 25 10:53:26 2005 for Hofmeier_FYP:libcomm by doxygen1.2.15