daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #udpserver.pl
  3.  
  4. use IO::Socket::INET;
  5.  
  6. # flush after every write
  7. $| = 1;
  8.  
  9. my ($socket,$received_data);
  10.  
  11. #  we call IO::Socket::INET->new() to create the UDP Socket and bound
  12. # to specific port number mentioned in LocalPort and there is no need to provide
  13. # LocalAddr explicitly as in TCPServer.
  14. $socket = new IO::Socket::INET ({
  15. LocalPort => '5000',
  16. Proto => 'udp',
  17. });
  18.  
  19. while(1)
  20. {
  21. # read operation on the socket
  22. $socket->recv($recieved_data,1024);
  23.  
  24. say $recieved_data;
  25.  
  26. }
  27.  
  28. $socket->close();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top