:orphan: # PETSC_VIEWER_SOCKET_ Creates a socket viewer shared by all processors in a communicator. ## Synopsis ``` PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm comm) ``` Collective ## Input Parameter - ***comm -*** the MPI communicator to share the `PETSCVIEWERSOCKET` `PetscViewer` ## Options Database Keys For use with the default `PETSC_VIEWER_SOCKET_WORLD` or if `NULL` is passed for machine or `PETSC_DEFAULT` is passed for port - ***-viewer_socket_machine -*** machine to connect to - ***-viewer_socket_port -*** port to connect to ## Environmental variables - ***`PETSC_VIEWER_SOCKET_PORT` -*** portnumber - ***`PETSC_VIEWER_SOCKET_MACHINE` -*** machine name ## Notes Unlike almost all other PETSc routines, `PETSC_VIEWER_SOCKET_()` does not return an error code, it returns NULL if it fails. The `PETSCVIEWERSOCKET` `PetscViewer` is usually used in the form ```none XXXView(XXX object, PETSC_VIEWER_SOCKET_(comm)); ``` Currently the only socket client available is MATLAB. See src/dm/tests/ex12.c and ex12.m for an example of usage. Connects to a waiting socket and stays connected until `PetscViewerDestroy()` is called. Use this for communicating with an interactive MATLAB session, see `PETSC_VIEWER_MATLAB_()` for writing output to a .mat file. Use `PetscMatlabEngineCreate()` or `PETSC_MATLAB_ENGINE_()`, `PETSC_MATLAB_ENGINE_SELF`, or `PETSC_MATLAB_ENGINE_WORLD` for communicating with a MATLAB Engine ## See Also [](sec_viewers), `PETSCVIEWERMATLAB`, `PETSCVIEWERSOCKET`, `PETSC_VIEWER_SOCKET_WORLD`, `PETSC_VIEWER_SOCKET_SELF`, `PetscViewerSocketOpen()`, `PetscViewerCreate()`, `PetscViewerSocketSetConnection()`, `PetscViewerDestroy()`, `PETSC_VIEWER_SOCKET_()`, `PetscViewerBinaryWrite()`, `PetscViewerBinaryRead()`, `PetscViewerBinaryWriteStringArray()`, `PetscViewerBinaryGetDescriptor()`, `PETSC_VIEWER_MATLAB_()` ## Level intermediate ## Location src/sys/classes/viewer/impls/socket/send.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/socket/send.c) [Index of all Viewer routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)