Skip to main content
`Ctrl`+`K`

# PetscOpenSocket

handles connected to an open port where someone is waiting.

## Synopsis

    #include "petscviewer.h"
    PetscErrorCode PetscOpenSocket(const char hostname[], int portnum, int *t)

## Input Parameters

- hostname - for example www.mcs.anl.gov

- portnum - for example 80

## Output Parameter

- t - the socket number

## Notes

Use close() to close the socket connection

Use read() or `PetscHTTPRequest()` to read from the socket

## See Also

`PetscSocketListen()`, `PetscSocketEstablish()`, `PetscHTTPRequest()`, `PetscHTTPSConnect()`

## Level

advanced

## Location

src/sys/classes/viewer/impls/socket/send.c

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages