Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NAlexandrov/xk6-tcp
A k6 extension for sending data to TCP port
https://github.com/NAlexandrov/xk6-tcp
k6-extension xk6
Last synced: 11 days ago
JSON representation
A k6 extension for sending data to TCP port
- Host: GitHub
- URL: https://github.com/NAlexandrov/xk6-tcp
- Owner: NAlexandrov
- License: mit
- Created: 2021-07-02T15:43:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-07T06:53:15.000Z (4 months ago)
- Last Synced: 2024-07-30T21:05:39.190Z (3 months ago)
- Topics: k6-extension, xk6
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 12
- Watchers: 2
- Forks: 13
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-k6 - xk6-tcp - Send data to TCP port. (Extensions / Community)
README
# xk6-tcp
A k6 extension for sending strings to TCP port
## Build
To build a `k6` binary with this plugin, first ensure you have the prerequisites:
- [Go toolchain](https://go101.org/article/go-toolchain.html)
- GitThen:
1. Install `xk6`:
```shell
go install github.com/k6io/xk6/cmd/xk6@latest
```2. Build the binary:
```shell
xk6 build master \
--with github.com/NAlexandrov/xk6-tcp
```## Example
```javascript
import tcp from 'k6/x/tcp';
import { check } from 'k6';const conn = tcp.connect('host:port');
export default function () {
tcp.writeLn(conn, 'Say Hello');
let res = String.fromCharCode(...tcp.read(conn, 1024))
check (res, {
'verify ag tag': (res) => res.includes('Hello')
});
tcp.close(conn);
}
```