00001 /*========================================================================= 00002 00003 Program: Open IGT Link Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlClientSocket.h $ 00005 Language: C++ 00006 Date: $Date: 2010-06-09 16:16:36 -0400 (Wed, 09 Jun 2010) $ 00007 Version: $Revision: 6525 $ 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: vtkClientSocket.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 igtlClientSocket - Encapsulates a client socket. 00031 00032 #ifndef __igtlClientSocket_h 00033 #define __igtlClientSocket_h 00034 00035 #include "igtlSocket.h" 00036 #include "igtlWin32Header.h" 00037 00038 namespace igtl 00039 { 00040 00041 class ServerSocket; 00042 00043 class IGTLCommon_EXPORT ClientSocket : public Socket 00044 { 00045 public: 00046 typedef ClientSocket Self; 00047 typedef Socket Superclass; 00048 typedef SmartPointer<Self> Pointer; 00049 typedef SmartPointer<const Self> ConstPointer; 00050 00051 igtlTypeMacro(igtl::ClientSocket, igtl::Socket) 00052 igtlNewMacro(igtl::ClientSocket); 00053 00054 // Description: 00055 // Connects to host. Returns 0 on success, -1 on error. 00056 int ConnectToServer(const char* hostname, int port); 00057 00058 protected: 00059 ClientSocket(); 00060 ~ClientSocket(); 00061 00062 void PrintSelf(std::ostream& os) const; 00063 00064 //BTX 00065 friend class ServerSocket; 00066 //ETX 00067 private: 00068 ClientSocket(const ClientSocket&); // Not implemented. 00069 void operator=(const ClientSocket&); // Not implemented. 00070 }; 00071 00072 } 00073 00074 #endif 00075 00076