| 
    nidas v1.2.3
    
   | 
 
Implementation of an IOChannel, over a ServerSocket. More...
#include <Socket.h>

Classes | |
| class | ConnectionThread | 
Public Member Functions | |
| ServerSocket () | |
| Constructor.   | |
| ServerSocket (const nidas::util::SocketAddress &addr) | |
| Constructor.   | |
| ~ServerSocket () | |
| ServerSocket * | clone () const | 
| Derived classes must provide clone.   | |
| void | requestConnection (IOChannelRequester *service) | 
| IOChannel * | connect () | 
| const std::string & | getName () const | 
| void | setName (const std::string &val) | 
| int | getFd () const | 
| void | setKeepAliveIdleSecs (int val) | 
| Set the value of keepAliveIdleSecs.   | |
| int | getKeepAliveIdleSecs () const | 
| Return keepAliveIdleSecs for this ServerSocket.   | |
| void | setNonBlocking (bool val) | 
| The blocking flag that will be set on accepted connections.   | |
| bool | isNonBlocking () const | 
| size_t | read (void *, size_t) | 
| ServerSocket will never be called to do an actual read.   | |
| size_t | write (const void *, size_t) | 
| ServerSocket should never be called to do an actual write.   | |
| size_t | write (const struct iovec *, int) | 
| ServerSocket should never be called to do an actual write.   | |
| void | close () | 
| void | fromDOMElement (const xercesc::DOMElement *) | 
| xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const | 
| xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const | 
| virtual void | setRequestType (enum McSocketRequest) | 
| virtual enum McSocketRequest | getRequestType () const | 
| virtual bool | isNewInput () const | 
| Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file.   | |
| virtual int | getReconnectDelaySecs () const | 
| virtual const ConnectionInfo & | getConnectionInfo () const | 
| What is the IP address of the host at the other end of the connection.   | |
| virtual void | setConnectionInfo (const ConnectionInfo &val) | 
| virtual size_t | getBufferSize () const | 
| Return suggested buffer length.   | |
| virtual void | flush () | 
| Default flush implementation does nothing.   | |
| virtual dsm_time_t | createFile (dsm_time_t t, bool exact) | 
| Request that an IOChannel open a new file, with a name based on a time.   | |
| virtual bool | writeNidasHeader () const | 
| Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there.   | |
| virtual void | setDSMConfig (const DSMConfig *val) | 
| What DSM is this IOChannel connected to?   | |
| virtual const DSMConfig * | getDSMConfig () const | 
| What DSM is this IOChannel connected to? May be NULL.   | |
| virtual void | addSampleTag (const nidas::core::SampleTag *) | 
| The special NetcdfRPCChannel subclass needs a way to add a SampleTag to the IOChannel through a virtual base class.   | |
Static Public Member Functions | |
| static IOChannel * | createSocket (const xercesc::DOMElement *) | 
| Create either a Socket or a McSocket from a DOMElement.   | |
| static IOChannel * | createIOChannel (const xercesc::DOMElement *node) | 
| static const XMLCh * | getNamespaceURI () | 
Protected Member Functions | |
| ServerSocket (const ServerSocket &x) | |
| Copy constructor.   | |
Private Member Functions | |
| ServerSocket & | operator= (const ServerSocket &) | 
| No assignment.   | |
Private Attributes | |
| nidas::util::auto_ptr< nidas::util::SocketAddress > | _localSockAddr | 
| std::string | _name | 
| nidas::util::ServerSocket * | _servSock | 
| IOChannelRequester * | _iochanRequester | 
| ConnectionThread * | _connectionThread | 
| int | _keepAliveIdleSecs | 
| bool | _nonBlocking | 
| const DSMConfig * | _dsm | 
| ConnectionInfo | _conInfo | 
Static Private Attributes | |
| static XMLCh * | namespaceURI = 0 | 
Implementation of an IOChannel, over a ServerSocket.
| ServerSocket::ServerSocket | ( | ) | 
| ServerSocket::ServerSocket | ( | const nidas::util::SocketAddress & | addr | ) | 
Constructor.
References _localSockAddr, and setName().
| ServerSocket::~ServerSocket | ( | ) | 
References _connectionThread, _servSock, close(), DLOG, nidas::util::Thread::join(), and LOG_WARNING.
      
  | 
  protected | 
Copy constructor.
      
  | 
  virtualinherited | 
      
  | 
  virtual | 
      
  | 
  virtual | 
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References _connectionThread, _servSock, nidas::util::ServerSocket::close(), and nidas::core::ServerSocket::ConnectionThread::interrupt().
Referenced by ~ServerSocket().
      
  | 
  virtual | 
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References _keepAliveIdleSecs, _localSockAddr, _nonBlocking, _servSock, nidas::util::ServerSocket::accept(), nidas::core::getSample(), ILOG, and nidas::util::Socket::setKeepAliveIdleSecs().
      
  | 
  inlinevirtualinherited | 
Request that an IOChannel open a new file, with a name based on a time.
This should be implemented by derived classes which write to disk files. Other derived classes (e.g. sockets) can just use this default implementation - basically ignoring the request.
| t | Time to use when creating file name. | 
| exact | Use exact time when creating file name, else the time is adjusted to an even time interval. | 
| nidas::util::IOException | 
Reimplemented in nidas::core::FileSet.
References nidas::core::getSample().
Referenced by nidas::core::IOStream::createFile(), and nidas::core::SampleOutputBase::createNextFile().
| nidas::util::InvalidParameterException | 
References nidas::core::DOMObjectFactory::createObject(), nidas::core::Socket::createSocket(), and nidas::core::getSample().
Referenced by nidas::core::DSMService::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), and nidas::dynld::SampleInputStream::fromDOMElement().
Create either a Socket or a McSocket from a DOMElement.
| nidas::util::InvalidParameterException | 
Default flush implementation does nothing.
| nidas::util::IOException | 
Referenced by nidas::core::IOStream::flush().
Return suggested buffer length.
Reimplemented in nidas::core::DatagramSocket, nidas::core::MultipleUDPSockets, and nidas::core::Socket.
Referenced by nidas::dynld::SampleInputStream::SampleInputStream(), and nidas::dynld::SampleInputStream::SampleInputStream().
      
  | 
  inlinevirtualinherited | 
What is the IP address of the host at the other end of the connection.
If this IOChannel is not a socket then return INADDR_ANY, using the default constructor of an Inet4Address. Socket subclasses should override this.
References nidas::core::IOChannel::_conInfo.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
What DSM is this IOChannel connected to? May be NULL.
References nidas::core::IOChannel::_dsm.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
      
  | 
  inlinevirtual | 
Implements nidas::core::IOChannel.
References _servSock, and nidas::util::ServerSocket::getFd().
      
  | 
  inline | 
Return keepAliveIdleSecs for this ServerSocket.
| nidas::util::IOException | 
References _keepAliveIdleSecs.
      
  | 
  inlinevirtual | 
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
Reimplemented in nidas::core::FileSet.
Referenced by nidas::core::SampleOutputBase::getReconnectDelaySecs().
      
  | 
  inlinevirtualinherited | 
Reimplemented in nidas::core::McSocket, nidas::core::McSocketUDP, and nidas::core::Socket.
Referenced by nidas::dynld::RawSampleInputStream::fromDOMElement().
Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file.
This method is used by code which may need to do special things at the beginning of a file, like read a SampleInputHeader.
Reimplemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::Socket, and nidas::core::UnixIOChannel.
Referenced by nidas::core::IOStream::read(), nidas::core::IOStream::read(), and nidas::core::IOStream::readUntil().
      
  | 
  inlinevirtual | 
      
  | 
  private | 
No assignment.
ServerSocket will never be called to do an actual read.
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References nidas::core::getSample().
      
  | 
  virtual | 
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References _connectionThread, _iochanRequester, _localSockAddr, _servSock, getName(), nidas::core::getSample(), ILOG, nidas::util::Thread::isRunning(), and nidas::util::Thread::start().
      
  | 
  inlinevirtualinherited | 
References nidas::core::IOChannel::_conInfo, and nidas::core::getSample().
Referenced by nidas::core::Socket::connect().
What DSM is this IOChannel connected to?
References nidas::core::IOChannel::_dsm, and nidas::core::getSample().
Referenced by nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
Set the value of keepAliveIdleSecs.
This is set on each accepted socket connection. It does not pertain to the socket which is waiting for connections.
| nidas::util::IOException | 
References _keepAliveIdleSecs, and nidas::core::getSample().
Implements nidas::core::IOChannel.
References _name, and nidas::core::getSample().
Referenced by ServerSocket(), and ServerSocket().
The blocking flag that will be set on accepted connections.
The ServerSocket itself is always non-blocking.
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References _nonBlocking, and nidas::core::getSample().
      
  | 
  inlinevirtualinherited | 
      
  | 
  virtual | 
| xercesc::DOMException | 
Reimplemented from nidas::core::DOMable.
References nidas::core::getSample().
      
  | 
  virtual | 
| xercesc::DOMException | 
Reimplemented from nidas::core::DOMable.
References nidas::core::DOMable::getNamespaceURI(), and nidas::core::DOMable::toDOMElement().
ServerSocket should never be called to do an actual write.
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References nidas::core::getSample().
ServerSocket should never be called to do an actual write.
| nidas::util::IOException | 
Implements nidas::core::IOChannel.
References nidas::core::getSample().
Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there.
Reimplemented in nidas::core::DatagramSocket.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
      
  | 
  privateinherited | 
      
  | 
  private | 
Referenced by close(), requestConnection(), and ~ServerSocket().
      
  | 
  private | 
Referenced by requestConnection().
      
  | 
  private | 
Referenced by connect(), getKeepAliveIdleSecs(), and setKeepAliveIdleSecs().
      
  | 
  private | 
Referenced by connect(), requestConnection(), ServerSocket(), and ServerSocket().
      
  | 
  private | 
Referenced by connect(), isNonBlocking(), and setNonBlocking().
      
  | 
  private | 
Referenced by close(), connect(), getFd(), requestConnection(), and ~ServerSocket().
      
  | 
  staticprivateinherited | 
Referenced by nidas::core::DOMable::getNamespaceURI().