MongoDB  2.1.1-pre-
Public Member Functions | Protected Attributes
mongo::Socket Class Reference

thin wrapped around file descriptor and system calls todo: ssl More...

#include <sock.h>

Inheritance diagram for mongo::Socket:
mongo::MessagingPort

List of all members.

Public Member Functions

 Socket (int sock, const SockAddr &farEnd)
 Socket (double so_timeout=0, int logLevel=0)
 In some cases the timeout will actually be 2x this value - eg we do a partial send, then the timeout fires, then we try to send again, then the timeout fires again with no data sent, then we detect that the other side is down.
bool connect (SockAddr &farEnd)
void close ()
void send (const char *data, int len, const char *context)
void send (const vector< pair< char *, int > > &data, const char *context)
 sends all data or throws an exception
void recv (char *data, int len)
int unsafe_recv (char *buf, int max)
int getLogLevel () const
void setLogLevel (int ll)
SockAddr remoteAddr () const
string remoteString () const
unsigned remotePort () const
void clearCounters ()
long long getBytesIn () const
long long getBytesOut () const
void setTimeout (double secs)
bool stillConnected ()
void postFork ()
 call this after a fork for server sockets
int _send (const char *data, int len)
 raw send, same semantics as ::send

Protected Attributes

int _logLevel

Detailed Description

thin wrapped around file descriptor and system calls todo: ssl


Constructor & Destructor Documentation

mongo::Socket::Socket ( double  so_timeout = 0,
int  logLevel = 0 
)

In some cases the timeout will actually be 2x this value - eg we do a partial send, then the timeout fires, then we try to send again, then the timeout fires again with no data sent, then we detect that the other side is down.

Generally you don't want a timeout, you should be very prepared for errors if you set one.


Member Function Documentation

void mongo::Socket::send ( const vector< pair< char *, int > > &  data,
const char *  context 
)

sends all data or throws an exception

Parameters:
contextdescriptive for logging

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