Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cgsamp/tcp-server-test
https://github.com/cgsamp/tcp-server-test
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cgsamp/tcp-server-test
- Owner: cgsamp
- Created: 2024-05-31T18:29:09.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-04T17:44:52.000Z (8 months ago)
- Last Synced: 2024-06-04T19:52:38.322Z (8 months ago)
- Language: Java
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# TCP Router testing
Building an app to deploy to Cloud Foundry that listens to a certain port and reads the input. In a couple versions.
## TCP Routing on CF
### Enabling TCP Routing
https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html
In TAS, check the appropriate boxes in OpsMan. Optionally, increase the allowable port range to include 48556.
### Adjust router groups
CF TCP Routing by default delivers TCP traffic from any source to port 8080. This can be changed.
https://docs.cloudfoundry.org/devguide/custom-ports.html
`cf curl /routing/v1/router_groups/0d3d58c3-9f3f-4e3b-4df0-8cecc1c5a37a -d @update_router_group.json -X PUT`
## Running Locally
Start with
`mvn clean spring:boot run`
then
`nc localhost 8080 < testfile.bin`### Log example
```
2024-05-31T14:16:05.014-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Started App in 0.683 seconds (process running for 1.011)
2024-05-31T14:16:05.016-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Starting APP
2024-05-31T14:16:05.035-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Listening at 0.0.0.0 on port 8080
2024-05-31T14:16:06.949-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Received connection from /192.168.1.14:56192
2024-05-31T14:16:06.949-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Listening at 0.0.0.0 on port 8080
2024-05-31T14:16:37.570-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Received connection from /[0:0:0:0:0:0:0:1]:51958
2024-05-31T14:16:37.570-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Listening at 0.0.0.0 on port 8080
2024-05-31T14:16:37.570-04:00 INFO 86021 --- [pool-2-thread-3] tcproutes.lab.sampsoftware.net.App : bytesRead=9
2024-05-31T14:16:37.571-04:00 INFO 86021 --- [pool-2-thread-3] tcproutes.lab.sampsoftware.net.App : TThe incoming request is:[0x00 0x00]
2024-05-31T14:16:56.456-04:00 INFO 86021 --- [ main] tcproutes.lab.sampsoftware.net.App : Listening at 0.0.0.0 on port 8080
```## Deploying to CF
### Create Domain
`cf create-shared-domain test.tcp.tas.lab.sampsoftware.net --router-group default-tcp`
Ensure that the router group is updated to use the ports required if using custom ports. By default, Diego will deliver traffic from any TCP Router port to port 8080 on the container.
### CF Push
```
mvn clean package && cf push
cf logs very-simple-tcp-server
cf routes
nc [IP of TCP Router] 30000 < testfile.bin
```