VTK
vtkSocket.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSocket.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef vtkSocket_h
23 #define vtkSocket_h
24 
25 #include "vtkCommonSystemModule.h" // For export macro
26 #include "vtkObject.h"
27 
30 {
31 public:
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
35  // ----- Status API ----
37  int GetConnected() { return (this->SocketDescriptor >=0); }
38 
40  void CloseSocket();
41 
42  // ------ Communication API ---
45  int Send(const void* data, int length);
46 
52  int Receive(void* data, int length, int readFully=1);
53 
55 
57  vtkGetMacro(SocketDescriptor, int);
59 
61 
63  static int SelectSockets(const int* sockets_to_select, int size,
64  unsigned long msec, int* selected_index);
65 protected:
69 
71 
72  //BTX
73  friend class vtkSocketCollection;
74  //ETX
75 
78  int CreateSocket();
79 
81  void CloseSocket(int socketdescriptor);
82 
85  int BindSocket(int socketdescriptor, int port);
86 
89  int SelectSocket(int socketdescriptor, unsigned long msec);
90 
93  int Accept(int socketdescriptor);
94 
97  int Listen(int socketdescriptor);
98 
100  int Connect(int socketdescriptor, const char* hostname, int port);
101 
103  int GetPort(int socketdescriptor);
104 
105 private:
106  vtkSocket(const vtkSocket&); // Not implemented.
107  void operator=(const vtkSocket&); // Not implemented.
108 };
109 
110 
111 #endif
112 
vtkSocket::Send
int Send(const void *data, int length)
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkSocket::SelectSocket
int SelectSocket(int socketdescriptor, unsigned long msec)
vtkSocket::SelectSockets
static int SelectSockets(const int *sockets_to_select, int size, unsigned long msec, int *selected_index)
vtkSocket::Listen
int Listen(int socketdescriptor)
vtkSocket::Connect
int Connect(int socketdescriptor, const char *hostname, int port)
vtkSocket::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
VTKCOMMONSYSTEM_EXPORT
#define VTKCOMMONSYSTEM_EXPORT
Definition: vtkCommonSystemModule.h:15
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkSocket::GetConnected
int GetConnected()
Definition: vtkSocket.h:37
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkSocket::CloseSocket
void CloseSocket()
vtkSocketCollection
a collection for sockets.
Definition: vtkSocketCollection.h:31
vtkgl::length
GLuint GLsizei GLsizei * length
Definition: vtkgl.h:11992
vtkSocket::CreateSocket
int CreateSocket()
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkCommonSystemModule.h
vtkSocket::~vtkSocket
~vtkSocket()
vtkSocket::Accept
int Accept(int socketdescriptor)
vtkSocket::vtkSocket
vtkSocket()
vtkSocket::GetPort
int GetPort(int socketdescriptor)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkSocket::Receive
int Receive(void *data, int length, int readFully=1)
vtkSocket::SocketDescriptor
int SocketDescriptor
Definition: vtkSocket.h:70
vtkObject.h
vtkSocket::CloseSocket
void CloseSocket(int socketdescriptor)
vtkSocket
BSD socket encapsulation.
Definition: vtkSocket.h:30
vtkSocket::BindSocket
int BindSocket(int socketdescriptor, int port)
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843