#ifndef __BSOCKET_HPP__
#define __BSOCKET_HPP__
/* $Id: bgsocket.h,v 1.1 2000/02/18 09:04:17 dpfeifle Exp $ */
#include "bgobject.h"
class BGException { };
class BGSocketException : public BGException { };
class BGUnknownHostException : public BGSocketException { };
class BGCannotConnectException : public BGSocketException { };
class BGInetAddress
: public BGObject
{
public:
virtual BGString
toString ( );
virtual unsigned long
hash ( );
virtual bool
equals ( BGObject &obj );
virtual BGString
className ( );
static BGInetAddress
getByName (BGString host);
static BGInetAddress
getLocalHost ( );
BGString
getHostName ( );
char *
getAddress ( );
};
class BGSocket
: public BGObject
{
public:
BGSocket ( );
~BGSocket ( );
virtual BGString
toString ( );
virtual unsigned long
hash ( );
virtual bool
equals ( BGObject &obj );
virtual BGString
className ( );
void
connect ( const char*, long );// throw (BGSocketException);
long
send ( unsigned char*, long, long );
long
recv ( unsigned char*, long, long );
void
close ( );
long
descriptor ( ) { return lFD; };
private:
long
lFD;
};
class BGServerSocket
: public BGObject
{
public:
BGServerSocket (long port);
BGServerSocket (long port, long backlog);
BGServerSocket (long port, long backlog, BGInetAddress bindAddress);
virtual BGString
toString ( );
virtual unsigned long
hash ( );
virtual bool
equals (BGObject &obj);
virtual BGString
className ( );
long
getLocalPort ( );
BGSocket
accept ( );
void
close ( );
};
#endif
0.49-991205 written by Dimitri van Heesch,
© 1997-1999