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

ippSocket.h

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
00010 // Socket class header file
00011 #pragma once
00012 #include "ippdme/ippdme.h"
00013 
00014 class ippSocketImp;
00015 
00016 class IPPDME_EXT_CLASS ippSocket {
00017  
00018 public:
00019   
00020   typedef enum SERROR 
00021   {
00022     SOCKET_OK          = 0,
00023     SOCKET_WOULD_BLOCK = 10035L,
00024     SOCKET_IS_CONNECTED=10056L,
00025     SOCKET_CONNECTION_ABORTED,
00026     SOCKET_OTHER_ERROR = -1,
00027   };//  socket error
00028 
00029   // --- constructor
00030   
00031   ippSocket();
00032   virtual ~ippSocket();
00033 
00034 
00036   bool Create();  
00037 
00039   SERROR  Connect(const char* hostname, int port);
00040 
00042   void Close();
00043 
00044 
00047   //  or an error code otherwise
00048   SERROR Read(char *buffer,int size);
00049 
00052   // or an error code otherwise
00053   SERROR Write(const char *sendbuf);
00054 
00056   bool Listen(int portNumber);
00057 
00060   // to accept a connection pending client if any.
00061   // \return WSAEWOULDBLOCK if no client is attempting to connect yet
00062   // \return 0 if a connection has been extablished
00063   // in this case the socket passed as  a argument is 
00064   // initialised and can be used by the server to send /receive
00065   // data to /from the client.
00066   // \return\ a socket error otherwise.
00067   SERROR Accept(ippSocket& socket);
00068 
00069   // probe if the socket is capable of sending data
00070   // ( useful to detect if the socket is fully connected after a 
00071   //   call to Connect);
00072   SERROR CanSendData() ;
00073 
00075   bool IsValid() const;
00076 
00078   SERROR Ping();
00079 
00080   static bool Initialize(); //<! initialize the Win sock layer
00081 
00082 protected:
00083   std::auto_ptr<ippSocketImp> _imp;
00084 
00085 private:
00086   friend class ippSocketImp;
00088   ippSocket(const ippSocket&);
00089   void operator=(const ippSocket&);
00090 
00091 };
00092 

Generated on Wed Nov 8 00:20:00 2006 for IPPDME by  doxygen 1.4.1