• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Common/vtkSocket.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSocket.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00022 #ifndef __vtkSocket_h
00023 #define __vtkSocket_h
00024 
00025 #include "vtkObject.h"
00026 
00027 class vtkSocketCollection;
00028 class VTK_COMMON_EXPORT vtkSocket : public vtkObject
00029 {
00030 public:
00031   vtkTypeRevisionMacro(vtkSocket, vtkObject);
00032   void PrintSelf(ostream& os, vtkIndent indent);
00033 
00034   // ----- Status API ----
00036   int GetConnected() { return (this->SocketDescriptor >=0); }
00037 
00039   void CloseSocket() {this->CloseSocket(this->SocketDescriptor);}
00040  
00041   // ------ Communication API ---
00044   int Send(const void* data, int length);
00045 
00051   int Receive(void* data, int length, int readFully=1);
00052 
00053 protected:
00054   vtkSocket();
00055   ~vtkSocket();
00056 
00057   int SocketDescriptor;
00058   vtkGetMacro(SocketDescriptor, int);
00059 
00060   //BTX
00061   friend class vtkSocketCollection;
00062   //ETX
00063  
00066   int CreateSocket();
00067 
00069   void CloseSocket(int socketdescriptor);
00070 
00073   int BindSocket(int socketdescriptor, int port);
00074 
00077   int SelectSocket(int socketdescriptor, unsigned long msec);
00078 
00081   int Accept(int socketdescriptor);
00082 
00085   int Listen(int socketdescriptor);
00086 
00088   int Connect(int socketdescriptor, const char* hostname, int port);
00089 
00091   int GetPort(int socketdescriptor);
00092 
00094 
00096   static int SelectSockets(const int* sockets_to_select, int size,
00097     unsigned long msec, int* selected_index);
00099 private:
00100   vtkSocket(const vtkSocket&); // Not implemented.
00101   void operator=(const vtkSocket&); // Not implemented.
00102 };
00103 
00104 
00105 #endif
00106 

Generated by  doxygen 1.7.1