Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Net/TFTP/main.cpp File Reference

#include <j2k/Fred/Standard.hpp>
#include <j2k/Net/UDP/UDP_all.cpp>
#include <j2k/Net/TFTP/TFTP_Option.hpp>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main int    argc = 0,
char *    argv[] = NULL
 

Definition at line 12 of file main.cpp.

00013 {
00014    char buf[ BUFFER_SIZE ];
00015    short listeningport;
00016    short destport;
00017    char* desthost;
00018 
00019    if(  ( argc != 4 ) ||
00020        !( listeningport = atoi(argv[1]) ) ||
00021        !(      destport = atoi(argv[3]) )  )
00022    {
00023       printf("Usage: udp [listen port number] [destination machine] [destination port]\n");
00024       return 0;
00025    }
00026 
00027    desthost = argv[2];
00028 
00029    option.ArgParser( argc, argv );
00030 
00031    option->sender = new UDP_SocketClient( srvAddr, port );
00032 
00033    UnixSocketReceiver Receiver( listeningport );
00034    UnixSocketSender   Sender( desthost, destport );
00035 
00036    if ( Receiver.Listen() == NULL )
00037    {
00038       printf("Error listening to UDP port\n");
00039       return 0;
00040    }
00041 
00042    Sender.setSocket( Receiver.getSocket() );
00043 
00044    while(  fgets( buf, sizeof(buf), stdin )  )
00045    {
00046       Sender.SendMsg( buf, strlen(buf) );
00047    }
00048 
00049    return 0;
00050 }


Generated on Sun Oct 14 18:47:03 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001