D:/Zythum/DinoKod/Network/FileTransfer.h

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : FileTransfer.h
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 09/09/2002
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #ifndef __FILETRANSFER_H__
00012 #define __FILETRANSFER_H__
00013 
00014 #include "Network/NetworkDll.h"
00015 #include "Network/UDPClientSocket.h"
00016 #include "Network/UDPServerSocket.h"
00017 
00018 class KFile;
00019 //---------------------------------------------------------------------------------------------------------------------
00020 typedef enum _KNFILETRANSFER
00021 {
00022         KNFT_NEW,
00023         KNFT_DATA,
00024         KNFT_CLOSE
00025 } KNFILETRANSFER;
00026 
00027 //---------------------------------------------------------------------------------------------------------------------
00028 class NETWORK_API KFTClientConnection : public KUDPClientSocket
00029 {
00030 protected:
00031         KFile*                                          m_pFile;
00032         u32                                                     m_Size;
00033 
00034 public:
00035 
00036         KFTClientConnection();
00037         virtual ~KFTClientConnection();
00038         
00039         virtual void                            OnMessage( KInetAddr& Addr, KNetMsg& Msg );
00040 };
00041 
00042 //---------------------------------------------------------------------------------------------------------------------
00043 class NETWORK_API KFileTransfer : public KUDPServerSocket
00044 {
00045 protected:
00046         bool                                            m_bServer;
00047         KUDPClientSocket                        m_ClientSocket;
00048         KFile*                                          m_pFile;
00049         KTIME                                           m_LastTime;
00050 
00051 public:
00052         KFileTransfer();
00053         virtual ~KFileTransfer();
00054 
00055         virtual bool                            Init( bool bServer = false );
00056         virtual bool                            Manage();
00057         virtual void                            End();
00058                                                                 
00059         bool                                            IsConnected()                                   { return m_ClientSocket.IsConnected();          }
00060         bool                                            Connect( KStr pHostName );
00061         bool                                            PutFile( KStr pFileName );
00062 
00063         virtual KUDPClientSocket*       AllocClientSocket()                             { return new KFTClientConnection();                     }
00064 };
00065 
00066 #endif  __FILETRANSFER_H__

Generated on Sun Mar 25 20:02:15 2007 for Zythum Project by  doxygen 1.5.1-p1