2022-10-21 11:16:00 -04:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [writePort](./bitburner.ns.writeport.md)
|
|
|
|
|
|
|
|
## NS.writePort() method
|
|
|
|
|
|
|
|
Write data to a port.
|
|
|
|
|
2023-02-11 13:18:50 -05:00
|
|
|
**Signature:**
|
2022-10-21 11:16:00 -04:00
|
|
|
|
|
|
|
```typescript
|
2024-02-19 20:19:03 +01:00
|
|
|
writePort(portNumber: number, data: any): any;
|
2022-10-21 11:16:00 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2023-09-02 15:57:31 +01:00
|
|
|
| portNumber | number | Port to write to. Must be a positive integer. |
|
2024-02-19 20:19:03 +01:00
|
|
|
| data | any | Data to write, it's cloned with structuredClone(). |
|
2022-10-21 11:16:00 -04:00
|
|
|
|
2023-02-11 13:18:50 -05:00
|
|
|
**Returns:**
|
2022-10-21 11:16:00 -04:00
|
|
|
|
2024-02-19 20:19:03 +01:00
|
|
|
any
|
2022-10-21 11:16:00 -04:00
|
|
|
|
2022-11-20 12:07:22 -05:00
|
|
|
The data popped off the queue if it was full, or null if it was not full.
|
2022-10-21 11:16:00 -04:00
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
|
|
|
RAM cost: 0 GB
|
|
|
|
|
2022-11-20 12:07:22 -05:00
|
|
|
Write data to the given Netscript port.
|
2022-10-21 11:16:00 -04:00
|
|
|
|