Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

igtlServerSocket.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlServerSocket.h $
00005   Language:  C++
00006   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00007   Version:   $Revision: 3460 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 /*=========================================================================
00017 
00018   Program:   Visualization Toolkit
00019   Module:    $RCSfile: vtkServerSocket.h,v $
00020 
00021   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00022   All rights reserved.
00023   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00024 
00025      This software is distributed WITHOUT ANY WARRANTY; without even
00026      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00027      PURPOSE.  See the above copyright notice for more information.
00028 
00029 =========================================================================*/
00030 // .NAME igtlServerSocket - Encapsulate a socket that accepts connections.
00031 // .SECTION Description
00032 //
00033 
00034 #ifndef __igtlServerSocket_h
00035 #define __igtlServerSocket_h
00036 
00037 #include "igtlSocket.h"
00038 #include "igtlClientSocket.h"
00039 #include "igtlWin32Header.h"
00040 
00041 namespace igtl
00042 {
00043 
00044 class IGTLCommon_EXPORT ServerSocket : public Socket
00045 {
00046 public:
00047   typedef ServerSocket              Self;
00048   typedef Socket  Superclass;
00049   typedef SmartPointer<Self>        Pointer;
00050   typedef SmartPointer<const Self>  ConstPointer;
00051 
00052   igtlTypeMacro(igtl::ServerSocket, igtl::Socket);
00053   igtlNewMacro(igtl::ServerSocket);
00054 
00055   void PrintSelf(std::ostream& os);
00056 
00057   // Description:
00058   // Creates a server socket at a given port and binds to it.
00059   // Returns -1 on error. 0 on success.
00060   int CreateServer(int port);
00061 
00062   // Description:
00063   // Waits for a connection. When a connection is received
00064   // a new ClientSocket object is created and returned.
00065   // Returns NULL on timeout. 
00066   //ClientSocket* WaitForConnection(unsigned long msec=0);
00067   ClientSocket::Pointer WaitForConnection(unsigned long msec=0);
00068 
00069   // Description:
00070   // Returns the port on which the server is running.
00071   int GetServerPort();
00072 protected:
00073   ServerSocket();
00074   ~ServerSocket();
00075 
00076 private:
00077   ServerSocket(const ServerSocket&); // Not implemented.
00078   void operator=(const ServerSocket&); // Not implemented.
00079 };
00080 
00081 } // end of igtl namespace 
00082 
00083 
00084 #endif
00085 
00086 

Generated at Sat May 9 04:47:23 2009 for OpenIGTLink by doxygen 1.5.9 written by Dimitri van Heesch, © 1997-2000