Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkSocketCommunicator Class Reference

`#include <vtkSocketCommunicator.h>`

Inheritance diagram for vtkSocketCommunicator:

[legend]
Collaboration diagram for vtkSocketCommunicator:

[legend]
List of all members.

## Detailed Description

Process communication using Sockets.

Date:
  2002/11/08 18:15:14

Revision:
  1.28

This is a concrete implementation of vtkCommunicator which supports interprocess communication using BSD style sockets. It supports byte swapping for the communication of machines with different endianness.

Warning:
  Communication between 32 bit and 64 bit systems is not fully supported. If a type does not have the same length on both systems, this communicator can not be used to transfer data of that type.

See also:
  vtkCommunicator vtkSharedMemoryCommunicator vtkSocketController

Created by:
  - Geveci, Berk

CVS contributions (if > 5%):
  - Geveci, Berk (61%)
  - Law, Charles (15%)
  - Cedilnik, Andy (11%)
  - Lee, Jeff (8%)

CVS logs (CVSweb):
  - .`cxx` (`/Parallel/vtkSocketCommunicator.cxx)`
  - .`h` (`/Parallel/vtkSocketCommunicator.h)`

Tests:
  vtkSocketCommunicator (Tests)

Definition at line 72 of file vtkSocketCommunicator.h.

## Public Types

typedef vtkCommunicator | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
virtual int | WaitForConnection (int port)
virtual void | CloseConnection ()
virtual int | ConnectTo (char *hostName, int port)
int | ReceiveMessage (char *data, int *length, int maxlength)
int | SendMessage (const char *data, int length)
virtual int | GetSwapBytesInReceivedData ()
virtual int | GetIsConnected ()
int | Send (int *data, int length, int remoteProcessId, int tag)
int | Send (unsigned long *data, int length, int remoteProcessId, int tag)
int | Send (char *data, int length, int remoteProcessId, int tag)
int | Send (unsigned char *data, int length, int remoteProcessId, int tag)
int | Send (float *data, int length, int remoteProcessId, int tag)
int | Send (double *data, int length, int remoteProcessId, int tag)
int | Send (vtkDataObject *data, int remoteId, int tag)
int | Send (vtkDataArray *data, int remoteId, int tag)
int | Receive (int *data, int length, int remoteProcessId, int tag)
int | Receive (unsigned long *data, int length, int remoteProcessId, int tag)
int | Receive (char *data, int length, int remoteProcessId, int tag)
int | Receive (unsigned char *data, int length, int remoteProcessId, int tag)
int | Receive (float *data, int length, int remoteProcessId, int tag)
int | Receive (double *data, int length, int remoteProcessId, int tag)
int | Receive (vtkDataObject *data, int remoteId, int tag)
int | Receive (vtkDataArray *data, int remoteId, int tag)
virtual void | SetPerformHandshake (int)
virtual void | PerformHandshakeOn ()
virtual void | PerformHandshakeOff ()
virtual int | GetPerformHandshake ()

## Static Public Methods

vtkSocketCommunicator * | New ()
int | IsTypeOf (const char *type)
vtkSocketCommunicator * | SafeDownCast (vtkObject *o)

## Protected Methods

| vtkSocketCommunicator ()
| ~vtkSocketCommunicator ()
int | ReceiveMessage (char *data, int size, int length, int tag)

## Protected Attributes

int | Socket
int | IsConnected
int | NumberOfProcesses
int | SwapBytesInReceivedData
int | PerformHandshake
ofstream * | TraceFile

## Member Typedef Documentation

typedef vtkCommunicator vtkSocketCommunicator::Superclass

| Reimplemented from vtkCommunicator. Definition at line 76 of file vtkSocketCommunicator.h.

## Constructor & Destructor Documentation

vtkSocketCommunicator::vtkSocketCommunicator | ( |  | ) | `[protected]`

vtkSocketCommunicator::~vtkSocketCommunicator | ( |  | ) | `[protected]`

## Member Function Documentation

vtkSocketCommunicator* vtkSocketCommunicator::New | ( |  | ) | `[static]`

| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkObject.

virtual const char* vtkSocketCommunicator::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkCommunicator.

int vtkSocketCommunicator::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkCommunicator.

vtkSocketCommunicator* vtkSocketCommunicator::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkCommunicator.

void vtkSocketCommunicator::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::WaitForConnection | ( | int | port | ) | `[virtual]`

| Wait for connection on a given port.

virtual void vtkSocketCommunicator::CloseConnection | ( |  | ) | `[virtual]`

| Close a connection.

virtual int vtkSocketCommunicator::ConnectTo | ( | char * | hostName,
|  | int | port
| ) | `[virtual]`

| Open a connection to host.

virtual int vtkSocketCommunicator::GetSwapBytesInReceivedData | ( |  | ) | `[virtual]`

| Returns 1 if bytes must be swapped in received ints, floats, etc

virtual int vtkSocketCommunicator::GetIsConnected | ( |  | ) | `[virtual]`

| Is the communicator connected?.

int vtkSocketCommunicator::Send | ( | int * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | unsigned long * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | char * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | unsigned char * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | float * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | double * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Implements vtkCommunicator.

int vtkSocketCommunicator::Send | ( | vtkDataObject * | data,
|  | int | remoteId,
|  | int | tag
| ) | `[inline, virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Reimplemented from vtkCommunicator. Definition at line 113 of file vtkSocketCommunicator.h. References vtkCommunicator::Send().

int vtkSocketCommunicator::Send | ( | vtkDataArray * | data,
|  | int | remoteId,
|  | int | tag
| ) | `[inline, virtual]`

| This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process. Reimplemented from vtkCommunicator. Definition at line 115 of file vtkSocketCommunicator.h. References vtkCommunicator::Send().

int vtkSocketCommunicator::Receive | ( | int * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | unsigned long * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | char * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | unsigned char * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | float * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | double * | data,
|  | int | length,
|  | int | remoteProcessId,
|  | int | tag
| ) | `[virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Implements vtkCommunicator.

int vtkSocketCommunicator::Receive | ( | vtkDataObject * | data,
|  | int | remoteId,
|  | int | tag
| ) | `[inline, virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Reimplemented from vtkCommunicator. Definition at line 132 of file vtkSocketCommunicator.h. References vtkCommunicator::Receive().

int vtkSocketCommunicator::Receive | ( | vtkDataArray * | data,
|  | int | remoteId,
|  | int | tag
| ) | `[inline, virtual]`

| This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data. Reimplemented from vtkCommunicator. Definition at line 134 of file vtkSocketCommunicator.h. References vtkCommunicator::Receive().

virtual void vtkSocketCommunicator::SetPerformHandshake | ( | int |  | ) | `[virtual]`

| Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual void vtkSocketCommunicator::PerformHandshakeOn | ( |  | ) | `[virtual]`

| Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual void vtkSocketCommunicator::PerformHandshakeOff | ( |  | ) | `[virtual]`

| Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual int vtkSocketCommunicator::GetPerformHandshake | ( |  | ) | `[virtual]`

| Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

int vtkSocketCommunicator::ReceiveMessage | ( | char * | data,
|  | int * | length,
|  | int | maxlength
| ) |

| Wait for message and store it in the data. The message has maximum length of maxlength. It's actual length is stored in length.

int vtkSocketCommunicator::SendMessage | ( | const char * | data,
|  | int | length
| ) |

| Send message.

int vtkSocketCommunicator::ReceiveMessage | ( | char * | data,
|  | int | size,
|  | int | length,
|  | int | tag
| ) | `[protected]`

## Member Data Documentation

int vtkSocketCommunicator::Socket`[protected]`

| Definition at line 154 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::IsConnected`[protected]`

| Definition at line 155 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::NumberOfProcesses`[protected]`

| Definition at line 156 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::SwapBytesInReceivedData`[protected]`

| Definition at line 157 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::PerformHandshake`[protected]`

| Definition at line 158 of file vtkSocketCommunicator.h.

ofstream* vtkSocketCommunicator::TraceFile`[protected]`

| Definition at line 165 of file vtkSocketCommunicator.h.

The documentation for this class was generated from the following file:

- Parallel/vtkSocketCommunicator.h