Hello milanpwc,
Welcome to the Monastery. This question has been asked and answered before with different approaches (see here How to find out whether socket is still connected?).
Another possible way independent the protocol (UDP / TCP) is the module IO::Socket::INET which has the connected method that you can use before sending the data. For example:
while ( 1 ) { unless ($sock->connected) { $sock->connect($port, $ip) or die $!; } # ... }
Hope this helps, BR.
In reply to Re: IO::Socket recv and send
by thanos1983
in thread IO::Socket recv and send
by milanpwc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |