Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

Socket.h

00001 /*
00002  * $Id: Socket.h,v 1.17 2003/06/30 00:18:06 mindstorm2600 Exp $
00003  */
00004 #ifndef ___SOCKET_H__
00005 #define ___SOCKET_H__
00006 #ifndef UNIX_SOCKETS
00007 #include <SDL_net.h>
00008 #else
00009 #include<sys/socket.h>
00010 #endif
00011 
00012 #include<String.h>
00013 #include<SocketBase.h>
00014 #include<Exception.h>
00015 
00016 namespace clawsoft{ //Namespace starts
00017 
00025 class Socket:public SocketBase{
00026  protected:
00028   char *host;
00034   int CreateSocket(const char *thehost, int theport);
00035  public:
00037   Socket(){;}
00043   Socket(const char *thehost, int theport);
00049   //Socket(String const thehost, int theport);
00056   Socket(TCPsocket s, int pport);
00060   Socket(const Socket &s);
00061   Socket &operator=(Socket s);
00065   ~Socket(){
00066   }
00070   void close(void);
00074   const int getPort(){
00075    return port;
00076   }
00080   Socket &operator<<(const char chr);
00084   Socket &operator<<(const int value);
00088   Socket &operator<<(const unsigned int value);
00092   Socket &operator<<(const float value);
00096   Socket &operator<<(const double value);
00100   Socket &operator<<(const long double value);
00104   Socket &operator<<(const long value);
00108   Socket &operator<<(const unsigned long value);
00112   Socket &operator<<(const Uint64 value);
00117   Socket &operator<<(String &str);
00118 
00122   Socket &operator<<(const char *str);
00129   void write(const void *buffer, unsigned long size);
00130 
00131 
00132 
00133 
00134 
00138   Socket &operator>>(char &chr);
00142   Socket &operator>>(int &value);
00146   Socket &operator>>(unsigned int &value);
00150   Socket &operator>>(float &value);
00154   Socket &operator>>(double &value);
00158   Socket &operator>>(long double &value);
00162   Socket &operator>>(long &value);
00166   Socket &operator>>(unsigned long &value);
00170   Socket &operator>>(Uint64 &value);
00174   Socket &operator>>(String &str);
00181   void read(void *buffer, unsigned long size);
00182 
00183 
00184 };
00185 
00186 
00187 }; //End of namespace directive
00188 
00189 #endif

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo