-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul the old TCP server type to use PodeListener not TCPListener #902
Comments
So I am in the middle of testing Arbitrary TCP with Cloudflare Tunnels. I was hoping to use PODE for this, but I haven't been able to get the example implementation working (not using the tunnel). I don't seem to get any output when I send a TCP Message. Using the example here to send a TCP Message with Powershell: https://riptutorial.com/powershell/example/18118/tcp-sender Using the TCP-Server example, doesn't seem to work. I am uncertain of where to troubleshoot this at. Is the example TCP-Server example validated to be fully functional? One thing I notice is that if an Endpoint is specified, when pode start the only verbose console output I see is tcp://:8999 there's no domain or IP address. I'm fairly new to this so I'm not certain where to troubleshoot first |
Hi @phatmandrake, With the way TCP works at the moment, in the example, delete the The example is expecting a client to connect, read the message written by the Pode server, and then the client sends its own message for Pode to read. If you're just sending a message for Pode to read, then you only need the As you've probably noticed from |
I've given the TCP server type it's first overhaul. This completely breaks the old implementation, but seeing as it was never documented, unstable, and never stated to exist, this should be all right. It no longer uses Start-PodeServer {
Add-PodeEndpoint -Address * -Port 8999 -Protocol Tcp
# hello verb
Add-PodeVerb -Verb 'HELLO :forename :surname' -ScriptBlock {
Write-PodeTcpClient -Message "HI, $($TcpEvent.Parameters.forename) $($TcpEvent.Parameters.surname)"
}
# catch-all verb
Add-PodeVerb -Verb '*' -ScriptBlock {
Write-PodeTcpClient -Message "Unrecognised verb sent"
}
# quit verb
Add-PodeVerb -Verb 'Quit' -Close
} If you were to connect to The TCP endpoints also support SSL, as both implicit and explicit TLS (implicit by default). If you wanted to use explicit and have an "upgrade" verb, you could do: Add-PodeVerb -Verb 'StartTLS' -UpgradeToSsl In a verb's scriptblock, you can use Note: If you test this via telnet, you'll need to pass |
There's an old, undocumented server type in Pode: TCP.
It needs an overhaul to move away from TCPListener, and use the PodeListener. This will make multiple endpoint support possible, better socket support and support certificate/ssl streams as well.
The current implementation is not great - hence never being documented. This should make it far better, and allow people to build anything on TCP sockets using Pode - not just web servers :)
The text was updated successfully, but these errors were encountered: