osg::Socket Class Reference
[Network]

Abstract network socket handler. More...

#include <OSGSocket.h>

Inheritance diagram for osg::Socket:

osg::DgramSocket osg::StreamSocket

List of all members.

Public Member Functions

Constructors


 Socket (void)
 Socket (const Socket &source)
Destructor


virtual ~Socket ()
open, close, connect


virtual void open (void)=0
virtual void close (void)=0
void bind (const SocketAddress &address=SocketAddress(SocketAddress::ANY))
void listen (int maxPending=10)
void connect (const SocketAddress &address)
read, write


int recv (void *buf, int size)
int recvAvailable (void *buf, int size)
int recv (NetworkMessage &msg)
int peek (void *buf, int size)
int send (const void *buf, int size)
int send (NetworkMessage &msg)
state access


void setReusePort (bool value)
void setBlocking (bool value)
SocketAddress getAddress (void)
void setReadBufferSize (int size)
void setWriteBufferSize (int size)
int getReadBufferSize (void)
int getWriteBufferSize (void)
int getAvailable (void)
bool waitReadable (double duration)
bool waitWritable (double duration)
Assignment


const Socketoperator= (const Socket &source)

Static Public Member Functions

Error information


static int getError (void)
static int getHostError (void)
static std::string getErrorStr (void)
static std::string getHostErrorStr (void)

Protected Types

typedef void SocketOptT
typedef socklen_t SocketLenT

Protected Attributes

member


int _sd

Static Private Attributes

static member


static int initialized = 0

Friends

class SocketSelection


Detailed Description

Socket baseclass. The Socket class wraps a socket descriptor. This class has no additional state variables. It is only h handle to the underlaying descriptor. Class createion and destruction has no influence to any descriptor. Use open to assign a descriptor and close to remove it from the system. If this class is copied, then there are to classes which uses the same descriptor. This is ok until you call close for one of this classes. One purpose of this implementation is to hide the differences between Windows and Unix sockets. Calls to this class should behave equally on all systems. As a result, some methods will not work as an experienced Windows ore Unix programmer maight expect. Please refere to the function docu to get details about this.

Definition at line 53 of file OSGSocket.h.


Member Typedef Documentation

typedef void osg::Socket::SocketOptT [protected]

Socket option type. Used to hide the different interface implementations

Definition at line 139 of file OSGSocket.h.

typedef socklen_t osg::Socket::SocketLenT [protected]

Socket length type. Used to hide the different interface implementations

Definition at line 146 of file OSGSocket.h.


Constructor & Destructor Documentation

Socket::Socket ( void   ) 

Create a new Socket class. A valid socket descriptor will be assigned by calling open on a derived Socket class e.g. StreamSocket or DgramSocket. On Windows WSAStartup is called by the first socket createn.

Definition at line 108 of file OSGSocket.cpp.

References initialized.

00108                   :
00109     _sd(-1)
00110 {
00111     if(!initialized)
00112     {
00113         initialized=1;
00114 #ifdef WIN32
00115         WSADATA wsaData;
00116         
00117         WORD wVersionRequested = MAKEWORD( 2, 2 ); 
00118         if(WSAStartup( wVersionRequested, &wsaData )!=0)
00119         {
00120             throw SocketError("WSAStartup()");
00121         }
00122 #endif
00123     }
00124 }

Socket::Socket ( const Socket source  ) 

Copy constructor

Definition at line 128 of file OSGSocket.cpp.

00128                                   :
00129     _sd(source._sd)
00130 {
00131 }

Socket::~Socket (  )  [virtual]

Destructor. The Socket class is only a descriptor to the socket. By destruction of this class, the socket remains open.

Definition at line 136 of file OSGSocket.cpp.

00137 {
00138 }


Member Function Documentation

virtual void osg::Socket::open ( void   )  [pure virtual]

Implemented in osg::DgramSocket, and osg::StreamSocket.

virtual void osg::Socket::close ( void   )  [pure virtual]

Implemented in osg::DgramSocket, and osg::StreamSocket.

void Socket::bind ( const SocketAddress address = SocketAddress(SocketAddress::ANY)  ) 

Bind a socket to a given SocketAddress. It is possible to bind a Socket to a special network interface ore to all availabel interfaces.

    sock.bind(AnySocketAddress(23344));           Bind Socket to port 23344 
    sock.bind(Address("123.223.112.33",0);  Bind to the given adapter
    sock.bind(AnySocketAddress(0));               Bind to a free port      
    port = sock.getAddress().getPort();     Get bound port
    

Definition at line 153 of file OSGSocket.cpp.

References _sd, getError(), osg::SocketAddress::getSockAddr(), and osg::SocketAddress::getSockAddrSize().

Referenced by osg::ClusterServer::acceptClient(), osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), osg::GroupMCastConnection::GroupMCastConnection(), osg::PointSockPipeline::initialize(), and osg::PointMCastConnection::initialize().

00154 {
00155     SocketAddress result=address;
00156     
00157     if( ::bind(_sd,
00158                result.getSockAddr(),
00159                result.getSockAddrSize()) < 0)
00160     {
00161         if(getError() ==
00162 #if defined WIN32
00163             WSAEADDRINUSE 
00164 #else
00165             EADDRINUSE
00166 #endif
00167         )
00168         {
00169             throw SocketInUse("bind()");
00170         }
00171         else
00172         {
00173             throw SocketError("bind()");
00174         }
00175     }
00176 }

void Socket::listen ( int  maxPending = 10  ) 

Set queue length for incomming connection requests

Definition at line 180 of file OSGSocket.cpp.

References _sd.

Referenced by osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), and osg::PointSockPipeline::initialize().

00181 {
00182     if(::listen(_sd,maxPending)<0)
00183     {
00184         throw SocketError("listen()");
00185     }
00186 }

void Socket::connect ( const SocketAddress address  ) 

Connect to the given address. After connect, all send data will be transfered to the address.

Definition at line 191 of file OSGSocket.cpp.

References _sd, osg::SocketAddress::getSockAddr(), and osg::SocketAddress::getSockAddrSize().

Referenced by osg::GroupSockConnection::connectSocket(), osg::PointSockPipeline::initialize(), and osg::GroupSockPipeline::initialize().

00192 {
00193     if( ::connect(_sd,
00194                   address.getSockAddr(),
00195                   address.getSockAddrSize()) )
00196     {
00197         throw SocketError("connect()");
00198     }
00199 }

int Socket::recv ( void *  buf,
int  size 
)

Read size bytes into the buffer. Wait until size Bytes are available On Dgram sockets data maight be lossed, if size is smaller then the incomming package. This situation will not be treated as an error.

See also:
recvAvailable recvFrom

Definition at line 209 of file OSGSocket.cpp.

References _sd, and getError().

Referenced by osg::PointSockPipeline::initialize(), osg::PointMCastConnection::initialize(), peek(), osg::PointSockPipeline::read(), osg::PointSockConnection::read(), osg::PointSockPipeline::readBuffer(), osg::PointSockConnection::readBuffer(), recv(), recvAvailable(), osg::PointMCastConnection::recvQueue(), and osg::PointSockConnection::wait().

00210 {
00211     int readSize;
00212     int pos=0;
00213 
00214     while(size)
00215     {
00216         readSize=::recv(_sd,((char*)buf) + pos,size,0);
00217         if(readSize < 0)
00218         {
00219 #if defined WIN32
00220             if(getError() == WSAECONNRESET)
00221             {
00222                 throw SocketConnReset("recv");
00223             }
00224             if(getError() == WSAEMSGSIZE)
00225             {
00226                 readSize=size;
00227             }
00228             else
00229 #endif
00230             throw SocketError("recv()");
00231         }
00232         if(readSize == 0)
00233         {
00234             return 0;
00235         }
00236         size-=readSize;
00237         pos +=readSize;
00238     }
00239     return pos;
00240 }

int Socket::recvAvailable ( void *  buf,
int  size 
)

Read the data from the in buffer to a maximun length of size. don't wait until size bytes are available.

See also:
recv

Definition at line 246 of file OSGSocket.cpp.

References _sd, getError(), and recv().

00247 {
00248     int len;
00249 
00250 #ifndef WIN32
00251     do
00252     {
00253 #endif
00254         len=::recv(_sd,(char*)buf,size,0);
00255 #ifndef WIN32
00256     } 
00257     while(len < 0 && errno == EAGAIN);
00258 #endif
00259     if(len==-1)
00260     {
00261 #if defined WIN32
00262         switch(getError())
00263         {
00264         case WSAECONNRESET:
00265             throw SocketConnReset("recvAvailable()");
00266             break;
00267         case WSAEMSGSIZE:
00268             len=size;
00269             break;
00270         default:
00271             throw SocketError("recv()");
00272         }
00273 #else
00274         throw SocketError("recv()");
00275 #endif
00276     }
00277     return len;
00278 }

int Socket::recv ( NetworkMessage msg  ) 

Like recv, but buffer and size is taken from the NetworkMessage

See also:
recv

Definition at line 283 of file OSGSocket.cpp.

References osg::NetworkMessage::getBuffer(), osg::NetworkMessage::getSize(), osg::osgntohl(), peek(), recv(), osg::NetworkMessage::setSize(), and osg::NetworkMessage::Header::size.

00284 {
00285     NetworkMessage::Header hdr;
00286     peek(&hdr,sizeof(hdr));
00287     msg.setSize(osgntohl(hdr.size));
00288     return recv(msg.getBuffer(),msg.getSize());
00289 }

int Socket::peek ( void *  buf,
int  size 
)

Read size bytes into the buffer. Wait until size Bytes are available On Dgram sockets data maight be lossed, if size is smaller then the incomming package. This situation will not be treated as an error. The read bytes will not be removed from the in buffer. A call to recv after peek will result in the same data.

See also:
recv recvAvailable

Definition at line 298 of file OSGSocket.cpp.

References _sd, getError(), and recv().

Referenced by recv(), and osg::DgramSocket::recvFrom().

00299 {
00300     int readSize;
00301     int pos=0;
00302 
00303     do
00304     {
00305         readSize=::recv(_sd,((char*)buf)+pos,size,MSG_PEEK);
00306         if(readSize<0)
00307         {
00308 #if defined WIN32
00309             if(getError() == WSAECONNRESET)
00310             {
00311                 throw SocketConnReset("peek");
00312             }
00313             if(getError() == WSAEMSGSIZE)
00314             {
00315                 readSize=size;
00316             }
00317             else
00318 #endif
00319                 throw SocketError("peek");
00320         }
00321         if(readSize == 0)
00322         {
00323             return 0;
00324         }
00325     }
00326     while(readSize != size);
00327     return readSize;
00328 }

int Socket::send ( const void *  buf,
int  size 
)

Write size bytes to the socket. This method maight block, if the output buffer is full.

Definition at line 333 of file OSGSocket.cpp.

References _sd.

Referenced by osg::PointSockPipeline::initialize(), osg::PointMCastConnection::initialize(), osg::PointSockPipeline::read(), osg::PointSockPipeline::readBuffer(), send(), osg::PointSockConnection::signal(), osg::PointSockConnection::write(), osg::GroupSockPipeline::write(), osg::PointSockConnection::writeBuffer(), and osg::GroupSockPipeline::writeBuffer().

00334 {
00335     int writeSize;
00336     int pos=0;
00337     while(size)
00338     {
00339 #if defined(WIN32) && defined(MSG_NOSIGNAL)
00340         writeSize=::send(_sd,((const char*)buf)+pos,size,MSG_NOSIGNAL);
00341 #else
00342         writeSize=::send(_sd,((const char*)buf)+pos,size,0);
00343 #endif
00344         if(writeSize == -1)
00345         {
00346             throw SocketError("send()");
00347         }
00348         if(writeSize == 0)
00349         {
00350             return 0;
00351         }
00352         size-=writeSize;
00353         pos+=writeSize;
00354     }
00355     return pos;
00356 }

int Socket::send ( NetworkMessage msg  ) 

Like send, but buffer and size is taken from the NetworkMessage

See also:
send

Definition at line 361 of file OSGSocket.cpp.

References osg::NetworkMessage::getBuffer(), osg::NetworkMessage::getHeader(), osg::NetworkMessage::getSize(), osg::osghtonl(), send(), and osg::NetworkMessage::Header::size.

00362 {
00363     NetworkMessage::Header &hdr=msg.getHeader();
00364     hdr.size=osghtonl(msg.getSize());
00365     return send(msg.getBuffer(),msg.getSize());
00366 }

void Socket::setReusePort ( bool  value  ) 

Enable, disable reuse port behavior If reuse port is true, then more then on process or thread is able to bind to the same port. This makes sense for multicast or braodcast sockets. For StreamSockets this feature can be used to avoid the Socket in use message on not propperly closed ports.

Definition at line 377 of file OSGSocket.cpp.

References _sd.

Referenced by osg::ClusterServer::acceptClient(), osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), osg::GroupSockConnection::GroupSockConnection(), osg::PointMCastConnection::initialize(), osg::PointMCastConnection::PointMCastConnection(), and osg::PointSockConnection::PointSockConnection().

00378 {
00379     int v=(int)value;
00380 #ifdef SO_REUSEPORT
00381     ::setsockopt(_sd,SOL_SOCKET,SO_REUSEPORT,(SocketOptT*)&v,sizeof(v));
00382 #endif
00383     ::setsockopt(_sd,SOL_SOCKET,SO_REUSEADDR,(SocketOptT*)&v,sizeof(v));
00384 }

void Socket::setBlocking ( bool  value  ) 

By default all recv, send, accept calls will block until the executeion is finished. This behavior can be swithed off bei setting blocking to false. This will lead to a more difficult programming. An easier way to get non blocking behavior is to use SocketSelections or waitReadable, waitWritable. These methods provide a timeout for waiting.

See also:
Socket::waitReadable Socket::waitWritable SocketSelection

Definition at line 394 of file OSGSocket.cpp.

References _sd.

00395 {
00396 #ifndef WIN32
00397     int val=0;
00398     
00399     if(value==false)
00400         val=O_NDELAY;
00401     if (fcntl(_sd, F_GETFL, &val) < 0) 
00402     {
00403         throw SocketError("fcntl()");
00404     }    
00405     val|=O_NDELAY;
00406     if(value)
00407     {
00408         val^=O_NDELAY;
00409     }
00410     if (fcntl(_sd, F_SETFL, val) < 0) 
00411     {
00412         throw SocketError("fcntl()");
00413     }    
00414 #else
00415     u_long ulVal = !value;
00416     if( (ioctlsocket(_sd, FIONBIO, &ulVal)) != 0) 
00417     {
00418         throw SocketError("ioctlsocket()");
00419     }    
00420 #endif
00421 }

SocketAddress Socket::getAddress ( void   ) 

Get bound SocketAddress

See also:
SocketAddress

Definition at line 426 of file OSGSocket.cpp.

References _sd, osg::SocketAddress::getSockAddr(), and osg::SocketAddress::getSockAddrSize().

Referenced by osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), osg::PointSockPipeline::initialize(), osg::PointMCastConnection::initialize(), and osg::GroupMCastConnection::initialize().

00427 {
00428     SocketAddress result;
00429     SocketLenT len;
00430 
00431     len=result.getSockAddrSize();
00432     if( ::getsockname(_sd,result.getSockAddr(),&len) < 0)
00433     {
00434         throw SocketError("getsockname()");
00435     }
00436     return result;
00437 }

void Socket::setReadBufferSize ( int  size  ) 

Set the internal read buffer size

See also:
Socket::getReadBufferSize

Definition at line 442 of file OSGSocket.cpp.

References _sd.

Referenced by osg::GroupSockConnection::acceptSocket(), osg::GroupSockConnection::connectSocket(), osg::GroupMCastConnection::GroupMCastConnection(), and osg::PointMCastConnection::initialize().

00443 {
00444     int v=(int)size;
00445     ::setsockopt(_sd,SOL_SOCKET,SO_RCVBUF,(SocketOptT*)&v,sizeof(v));
00446 }

void Socket::setWriteBufferSize ( int  size  ) 

Set the internal write buffer size

See also:
Socket::getWriteBufferSize

Definition at line 451 of file OSGSocket.cpp.

References _sd.

Referenced by osg::GroupSockConnection::acceptSocket(), and osg::GroupSockConnection::connectSocket().

00452 {
00453     int v=(int)size;
00454     ::setsockopt(_sd,SOL_SOCKET,SO_SNDBUF,(SocketOptT*)&v,sizeof(v));
00455 }

int Socket::getReadBufferSize ( void   ) 

Get internal read buffer size

See also:
Socket::setReadBufferSize

Definition at line 460 of file OSGSocket.cpp.

References _sd.

Referenced by osg::GroupMCastConnection::GroupMCastConnection().

00461 {
00462     int v;
00463     SocketLenT len=sizeof(v);
00464     ::getsockopt(_sd,SOL_SOCKET,SO_RCVBUF,(SocketOptT*)&v,&len);
00465     return v;
00466 }

int Socket::getWriteBufferSize ( void   ) 

Get internal write buffer size

See also:
Socket::setWriteBufferSize

Definition at line 471 of file OSGSocket.cpp.

References _sd.

00472 {
00473     int v;
00474     SocketLenT len=sizeof(v);
00475     ::getsockopt(_sd,SOL_SOCKET,SO_SNDBUF,(SocketOptT*)&v,&len);
00476     return v;
00477 }

int Socket::getAvailable ( void   ) 

Get number of bytes in the internal read buffer

Definition at line 481 of file OSGSocket.cpp.

References _sd.

00482 {
00483 #ifndef WIN32
00484     int value;
00485     if(::ioctl(_sd, FIONREAD, &value)<0)
00486     {    
00487         throw SocketError("ioctl()");
00488     }
00489     return value;
00490 #else
00491     u_long ulVal;
00492     if( (ioctlsocket(_sd, FIONREAD, &ulVal)) != 0) 
00493     {    
00494         throw SocketError("ioctlsocket()");
00495     }
00496     return (int)ulVal;
00497 #endif
00498 }

bool Socket::waitReadable ( double  duration  ) 

Wait until recv or accept will not block. True is returned if data is available.

Definition at line 503 of file OSGSocket.cpp.

References osg::SocketSelection::select(), and osg::SocketSelection::setRead().

Referenced by osg::ClusterServer::acceptClient(), osg::GroupSockConnection::acceptSocket(), osg::ClusterWindow::init(), osg::PointMCastConnection::recvQueue(), osg::PointSockPipeline::selectChannel(), osg::PointSockConnection::selectChannel(), osg::PointMCastConnection::selectChannel(), osg::GroupMCastConnection::sendQueue(), and osg::PointSockConnection::wait().

00504 {
00505     SocketSelection selection;
00506     selection.setRead(*this);
00507     if(selection.select(duration)==1)
00508         return true;
00509     else
00510         return false;
00511 }

bool Socket::waitWritable ( double  duration  ) 

Wait until send will not block for the given duration. True is returned if the next send will not block.

Definition at line 516 of file OSGSocket.cpp.

References osg::SocketSelection::select(), and osg::SocketSelection::setWrite().

00517 {
00518     SocketSelection selection;
00519     selection.setWrite(*this);
00520     if(selection.select(duration)==1)
00521         return true;
00522     else
00523         return false;
00524 }

const Socket & Socket::operator= ( const Socket source  ) 

assignment

Definition at line 528 of file OSGSocket.cpp.

References _sd.

00529 {
00530     _sd=source._sd;
00531     return *this;
00532 }

int Socket::getError ( void   )  [static]

Get last occured error

Definition at line 539 of file OSGSocket.cpp.

Referenced by bind(), getErrorStr(), peek(), osg::DgramSocket::peekFrom(), recv(), recvAvailable(), osg::DgramSocket::recvFrom(), and osg::SocketError::SocketError().

00540 {
00541 #ifdef WIN32
00542     return WSAGetLastError();
00543 #else
00544     return errno;
00545 #endif
00546 }

int Socket::getHostError ( void   )  [static]

Get last host error

Definition at line 550 of file OSGSocket.cpp.

Referenced by getHostErrorStr(), and osg::SocketHostError::SocketHostError().

00551 {
00552 #ifdef WIN32
00553     return WSAGetLastError();
00554 #else
00555     return h_errno;
00556 #endif
00557 }

std::string Socket::getErrorStr ( void   )  [static]

Get last occured error as string

Definition at line 561 of file OSGSocket.cpp.

References getError().

Referenced by osg::SocketError::SocketError().

00562 {
00563     const char *err=NULL;
00564 
00565 #ifdef WIN32
00566     switch(getError())
00567     {
00568         case WSAEINTR: err= "WSAEINTR"; break;
00569         case WSAEBADF: err= "WSAEBADF"; break;
00570         case WSAEFAULT: err= "WSAEFAULT"; break; 
00571         case WSAEINVAL: err= "WSAEINVAL"; break; 
00572         case WSAEMFILE: err= "WSAEMFILE"; break; 
00573         case WSAEWOULDBLOCK: err= "WSAEWOULDBLOCK"; break; 
00574         case WSAEINPROGRESS: err= "WSAEINPROGRESS"; break; 
00575         case WSAEALREADY: err= "WSAEALREADY"; break; 
00576         case WSAENOTSOCK: err= "WSAENOTSOCK"; break; 
00577         case WSAEDESTADDRREQ: err= "WSAEDESTADDRREQ"; break; 
00578         case WSAEMSGSIZE: err= "WSAEMSGSIZE"; break; 
00579         case WSAEPROTOTYPE: err= "WSAEPROTOTYPE"; break; 
00580         case WSAENOPROTOOPT: err= "WSAENOPROTOOPT"; break; 
00581         case WSAEPROTONOSUPPORT: err= "WSAEPROTONOSUPPORT"; break; 
00582         case WSAESOCKTNOSUPPORT: err= "WSAESOCKTNOSUPPORT"; break; 
00583         case WSAEOPNOTSUPP: err= "WSAEOPNOTSUPP"; break; 
00584         case WSAEPFNOSUPPORT: err= "WSAEPFNOSUPPORT"; break; 
00585         case WSAEAFNOSUPPORT: err= "WSAEAFNOSUPPORT"; break; 
00586         case WSAEADDRINUSE: err= "WSAEADDRINUSE"; break; 
00587         case WSAEADDRNOTAVAIL: err= "WSAEADDRNOTAVAIL"; break; 
00588         case WSAENETDOWN: err= "WSAENETDOWN"; break; 
00589         case WSAENETUNREACH: err= "WSAENETUNREACH"; break; 
00590         case WSAENETRESET: err= "WSAENETRESET"; break; 
00591         case WSAECONNABORTED: err= "WSAECONNABORTED"; break; 
00592         case WSAECONNRESET: err= "WSAECONNRESET"; break; 
00593         case WSAENOBUFS: err= "WSAENOBUFS"; break; 
00594         case WSAEISCONN: err= "WSAEISCONN"; break; 
00595         case WSAENOTCONN: err= "WSAENOTCONN"; break; 
00596         case WSAESHUTDOWN: err= "WSAESHUTDOWN"; break; 
00597         case WSAETOOMANYREFS: err= "WSAETOOMANYREFS"; break; 
00598         case WSAETIMEDOUT: err= "WSAETIMEDOUT"; break; 
00599         case WSAECONNREFUSED: err= "WSAECONNREFUSED"; break; 
00600         case WSAELOOP: err= "WSAELOOP"; break; 
00601         case WSAENAMETOOLONG: err= "WSAENAMETOOLONG"; break; 
00602         case WSAEHOSTDOWN: err= "WSAEHOSTDOWN"; break; 
00603         case WSAEHOSTUNREACH: err= "WSAEHOSTUNREACH"; break; 
00604         case WSASYSNOTREADY: err= "WSASYSNOTREADY"; break; 
00605         case WSAVERNOTSUPPORTED: err= "WSAVERNOTSUPPORTED"; break; 
00606         case WSANOTINITIALISED: err= "WSANOTINITIALISED"; break; 
00607         case WSAHOST_NOT_FOUND: err= "WSAHOST_NOT_FOUND"; break; 
00608         case WSATRY_AGAIN: err= "WSATRY_AGAIN"; break; 
00609         case WSANO_RECOVERY: err= "WSANO_RECOVERY"; break; 
00610         case WSANO_DATA: err= "WSANO_DATA"; break; 
00611     }
00612 #else
00613     err=strerror(getError());
00614 #endif
00615     if(err)
00616         return std::string(err);
00617     else
00618         return std::string("Unknown error");
00619 }

std::string Socket::getHostErrorStr ( void   )  [static]

Get last occured host error as string

Definition at line 623 of file OSGSocket.cpp.

References getHostError().

Referenced by osg::SocketHostError::SocketHostError().

00624 {
00625     const char *err;
00626 #if defined(WIN32) || defined(__hpux)
00627     err = strerror(getHostError());
00628 #else
00629     err = hstrerror(getHostError());
00630 #endif
00631     if(err)
00632         return std::string(err);
00633     else
00634         return std::string("Unknown error");
00635 }


Friends And Related Function Documentation

friend class SocketSelection [friend]

Definition at line 161 of file OSGSocket.h.


Member Data Documentation

int osg::Socket::_sd [protected]

int Socket::initialized = 0 [static, private]

Definition at line 167 of file OSGSocket.h.

Referenced by Socket().


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 11:11:09 2008 for OpenSG by  doxygen 1.5.5