:orphan:
# PetscSocketOpen
handles connected to an open port where someone is waiting. 
## Synopsis
```
PetscErrorCode PetscOpenSocket(const char hostname[], int portnum, int *t)
```

## Input Parameters

- ***url -*** 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
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/socket/send.c.html#PetscSocketOpen">src/sys/classes/viewer/impls/socket/send.c</A>


---
[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)  
