# PetscViewerSocketOpen

Opens a connection to a Matlab or other socket based server.

### Synopsis

    PetscErrorCode PETSC_DLLEXPORT PetscViewerSocketOpen(MPI_Comm comm,const char machine[],int port,PetscViewer *lab)

Collective on MPI_Comm

### Input Parameters

| comm | - the MPI communicator
| machine | - the machine the server is running on
| port | - the port to connect to, use PETSC_DEFAULT for the default

### Output Parameter

lab -a context to use when communicating with the server

### Notes

Most users should employ the following commands to access the Matlab PetscViewers

       PetscViewerSocketOpen(MPI_Comm comm, char *machine,int port,PetscViewer &viewer)

       MatView(Mat matrix,PetscViewer viewer)

                   or

       PetscViewerSocketOpen(MPI_Comm comm,char *machine,int port,PetscViewer &viewer)

       VecView(Vec vector,PetscViewer viewer)

### Options Database Keys

For use with the default Matlab PetscViewer, PETSC_VIEWER_SOCKET_WORLD, PETSC_VIEWER_SOCKET_SELF, PETSC_VIEWER_SOCKET_() or if PETSC_NULL is passed for machine or PETSC_DEFAULT is passed for port

       -viewer_socket_machine <machine>

       -viewer_socket_port <port>

### Environmental variables

| PETSC_VIEWER_SOCKET_PORT portnumber | - - PETSC_VIEWER_SOCKET_MACHINE machine name

Currently the only socket client available is Matlab. See src/dm/da/examples/tests/ex12.c and ex12.m for an example of usage.

### See Also

MatView(), VecView(), PetscViewerDestroy(), PetscViewerCreate(), PetscViewerSetType(),
PetscViewerSocketSetConnection(), PETSC_VIEWER_SOCKET_, PETSC_VIEWER_SOCKET_WORLD, PETSC_VIEWER_SOCKET_SELF

Level:intermediate
Location:src/sys/src/viewer/impls/socket/send.c
Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex29.c.html