Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Platform/Aperios1.3.2/UDPEndpoint.h

Go to the documentation of this file.
00001 /** 
00002 * @file  Platform/Aperios1.3.2/UDPEndpoint.h
00003 *
00004 * @author <A href=mailto:robocup@m-wachter.de>Michael Wachter</A>
00005 */
00006 
00007 #ifndef _UDPEndpoint_H_
00008 #define _UDPEndpoint_H_
00009 
00010 /**
00011 * static class for system calls
00012 * @attention the implementation is system specific!
00013 */
00014 
00015 #include "IPEndpoint.h"
00016 #include <UDPEndpointMsg.h>
00017 
00018 class UDPEndpoint : public IPEndpoint
00019 {
00020     public:
00021        UDPEndpoint(int sendBufferSize = 2048, int receiveBufferSize=2048);
00022       
00023        ~UDPEndpoint();
00024 
00025        /** binds endpoint to listen to port */
00026        int bind(int listenPort);     
00027  
00028        /** binds endpoint to listen to port and sets receiving host
00029            to address:port */
00030        int bind(int listenPort, char* address, int sendPort); 
00031        int bind(Port listenPort, IPAddress address, Port sendPort);
00032          
00033        /** sends data from the shared buffer (does no copy of data) */
00034        int send(int size);
00035      
00036      /** sends data from the shared buffer to a givern host/port */
00037      int send(int size, char* addr, int sPort);
00038 
00039        /** sends data to last specified other host (copies the data)*/
00040        int send(void* data,int size);
00041 
00042        /** sends data to other host */
00043        int send(void* data,int size, char* address,int port);
00044 
00045        /** sends data to other host */
00046        int send(void* data,int size, IPAddress address, int port);
00047 
00048        /** Called when new data arrives */
00049        virtual void onReceive(void* data,int size);
00050 
00051        /** Called from close() when connection closes */
00052        virtual void onClose();
00053      virtual void onSendingDone();
00054 
00055        /** Closes Endpoint in case of an error an error */
00056        void close();
00057 
00058        const char* getErrorString(UDPEndpointError error);
00059        const char* getErrorString();
00060 
00061        virtual void sendCont(antEnvMsg* msg);
00062        virtual void receiveCont(antEnvMsg* msg);
00063        virtual void closeCont(antEnvMsg* msg);
00064      
00065     protected: 
00066        IPAddress ipOfLastPackage;
00067 
00068     private:
00069        IPAddress address; /* IP address of the receiver */
00070        Port sendPort; /* port of the receiver */
00071        Port listenPort; /* port to listen for data */
00072        void startReceiving();
00073        
00074 };
00075    
00076 
00077 
00078 #endif 

Generated on Mon Mar 20 22:00:00 2006 for GT2005 by doxygen 1.3.6