00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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 vtkTypeMacro(vtkSocket, vtkObject);
00032 void PrintSelf(ostream& os, vtkIndent indent);
00033
00034
00036 int GetConnected() { return (this->SocketDescriptor >=0); }
00037
00039 void CloseSocket();
00040
00041
00044 int Send(const void* data, int length);
00045
00051 int Receive(void* data, int length, int readFully=1);
00052
00054
00056 vtkGetMacro(SocketDescriptor, int);
00058
00060
00062 static int SelectSockets(const int* sockets_to_select, int size,
00063 unsigned long msec, int* selected_index);
00064 protected:
00065 vtkSocket();
00066 ~vtkSocket();
00068
00069 int SocketDescriptor;
00070
00071
00072 friend class vtkSocketCollection;
00073
00074
00077 int CreateSocket();
00078
00080 void CloseSocket(int socketdescriptor);
00081
00084 int BindSocket(int socketdescriptor, int port);
00085
00088 int SelectSocket(int socketdescriptor, unsigned long msec);
00089
00092 int Accept(int socketdescriptor);
00093
00096 int Listen(int socketdescriptor);
00097
00099 int Connect(int socketdescriptor, const char* hostname, int port);
00100
00102 int GetPort(int socketdescriptor);
00103
00104 private:
00105 vtkSocket(const vtkSocket&);
00106 void operator=(const vtkSocket&);
00107 };
00108
00109
00110 #endif
00111