in reply to IO::Socket tutorial
First off, that seems to presume that you have a unix handy to check on the system call.
There are lots of webpages out there to look up man pages, such as https://manpages.debian.org/buster/manpages-dev/send.2.en.html.
No manual entry for send in section 2
On Debian-based systems like Ubuntu, there's a package manpages-dev that contains these man pages.
timeout mechanism
In my experience this can be accomplished with e.g. select (the multi-arg version), or the slightly higher-level IO::Select.
However, send and select are relatively low-level. Over time I've become more and more convinced that really the best way to do any communication with a delay is an asynchronous event-based system, of which select(2) is only the simplest. It takes a little getting used to, but it solves so many of the problems that synchronous code can suffer from that IMHO it's worth it. For example, I've used POE successfully (it has a bit of a learning curve but there's a cookbook), and recently I've been doing more with Mojolicious, and you can use its Mojo::IOLoop::Client and Mojo::IOLoop::Stream to implement a TCP client (Update: I posted an example here). If you were to show some example client code I might have the time to show what they would look like in Mojo.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: IO::Socket tutorial
by BernieC (Pilgrim) on Feb 19, 2020 at 12:25 UTC | |
by haukex (Archbishop) on Feb 19, 2020 at 15:48 UTC | |
by BernieC (Pilgrim) on Feb 19, 2020 at 21:05 UTC | |
by haukex (Archbishop) on Feb 20, 2020 at 00:31 UTC | |
by BernieC (Pilgrim) on Feb 20, 2020 at 12:22 UTC | |
|