FreeMat: vtkSocketCommunicator

FreeMat

- Main Page
- Related Pages

vtkSocketCommunicator

Section: Visualization Toolkit Parallel Classes

# Usage

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.

To create an instance of class vtkSocketCommunicator, simply invoke its constructor as follows

      obj = vtkSocketCommunicator

# Methods

The class vtkSocketCommunicator has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkSocketCommunicator class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkSocketCommunicator = obj.NewInstance ()`
- `vtkSocketCommunicator = obj.SafeDownCast (vtkObject o)`
- `int = obj.WaitForConnection (int port)` - Wait for connection on a given port. These methods return 1 on success, 0 on error.
- `int = obj.WaitForConnection (vtkServerSocket socket, long msec)` - Wait for connection on a given port. These methods return 1 on success, 0 on error.
- `obj.CloseConnection ()` - Close a connection.
- `int = obj.ConnectTo (string hostName, int port)` - Open a connection to host.
- `int = obj.GetSwapBytesInReceivedData ()` - Returns 1 if bytes must be swapped in received ints, floats, etc
- `int = obj.GetIsConnected ()` - Is the communicator connected?.
- `obj.SetNumberOfProcesses (int num)` - Set the number of processes you will be using.
- `obj.Barrier ()` - This class foolishly breaks the conventions of the superclass, so this overload fixes the method.
- `obj.SetPerformHandshake (int )` - 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 = obj.GetPerformHandshakeMinValue ()` - 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 = obj.GetPerformHandshakeMaxValue ()` - 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.
- `obj.PerformHandshakeOn ()` - 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.
- `obj.PerformHandshakeOff ()` - 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 = obj.GetPerformHandshake ()` - 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 = obj.LogToFile (string name)` - Log messages to the given file. The file is truncated unless the second argument is non-zero (default is to truncate). If the file name is empty or NULL, logging is disabled. Returns 0 if the file failed to open, and 1 otherwise.
- `int = obj.LogToFile (string name, int append)` - Log messages to the given file. The file is truncated unless the second argument is non-zero (default is to truncate). If the file name is empty or NULL, logging is disabled. Returns 0 if the file failed to open, and 1 otherwise.
- `obj.SetReportErrors (int )` - If ReportErrors if false, all vtkErrorMacros are suppressed.
- `int = obj.GetReportErrors ()` - If ReportErrors if false, all vtkErrorMacros are suppressed.
- `vtkClientSocket = obj.GetSocket ()` - Get/Set the actual socket used for communication.
- `obj.SetSocket (vtkClientSocket )` - Get/Set the actual socket used for communication.
- `int = obj.Handshake ()` - Performs handshake. This uses vtkClientSocket::ConnectingSide to decide whether to perform ServerSideHandshake or ClientSideHandshake.
- `int = obj.ServerSideHandshake ()` - Performs ServerSide handshake. One should preferably use Handshake() which calls ServerSideHandshake or ClientSideHandshake as required.
- `int = obj.ClientSideHandshake ()` - Performs ClientSide handshake. One should preferably use Handshake() which calls ServerSideHandshake or ClientSideHandshake as required.
- `int = obj.GetIsServer ()` - Returns true if this side of the socket is the server. The result is invalid if the socket is not connected.