This file is indexed.

/usr/share/doc/libwx-perl/examples/socket/wxSocketClientDatagram.pl is in libwx-perl 1:0.9923-4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/perl -w
#############################################################################
## Name:        samples/socket/wxSocketClientDatagram.pl
## Purpose:     wxDatagramSocket minimal demo
## Author:      Graciliano M. P., Mattia Barbon
## Created:     07/02/2003
## RCS-ID:      $Id: wxSocketClientDatagram.pl 2057 2007-06-18 23:03:00Z mbarbon $
## Copyright:   (c) 2004 Graciliano M. P., Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

use Wx;
use Wx::Socket ;

package MyApp;

  use vars qw(@ISA);
  @ISA=qw(Wx::App);

sub OnInit {
  my( $this ) = @_;

  my( $frame ) = MyFrame->new( "wxSocket Minimal demo",
			       Wx::Point->new( 50, 50 ),
			       Wx::Size->new( 450, 350 )
                             );

  $this->SetTopWindow( $frame );
  $frame->Show( 1 );

  1;
}

package MyFrame;
  use vars qw(@ISA);
  @ISA=qw(Wx::Frame);

  use Wx qw(:sizer wxTE_MULTILINE );
  use Wx::Event qw(EVT_BUTTON) ;

  use Wx qw(wxDefaultPosition wxDefaultSize wxDEFAULT wxNORMAL);

sub new {
  my( $class ) = shift;
  my( $this ) = $class->SUPER::new( undef, -1, $_[0], $_[1], $_[2] );

  my $top_s = Wx::BoxSizer->new( wxVERTICAL );

  my $text = Wx::TextCtrl->new( $this , -1, '' , wxDefaultPosition, [200,-1] , wxTE_MULTILINE );
  my $button = Wx::Button->new( $this, -1, 'Connect' );

  $this->{TEXT} = $text ;

  $top_s->Add( $text , 1, wxGROW|wxALL, 5 );
  $top_s->Add( $button , 0, wxGROW|wxALL, 0);

  $this->SetSizer( $top_s );
  $this->SetAutoLayout( 1 );

  EVT_BUTTON( $this, $button, \&OnConnect );

  return( $this ) ;

  $this;
}


#############
# ONCONNECT #
#############

sub OnConnect {
  my $this = shift ;

  use Wx qw(:socket) ;
  use Wx::Event qw(EVT_SOCKET_INPUT EVT_SOCKET_LOST) ;

  my $addr = Wx::IPV4address->new;
  $addr->SetHostname( 'localhost' );
  $addr->SetService( 5555 );
  my $sock = Wx::DatagramSocket->new( $addr );

  EVT_SOCKET_INPUT($this , $sock , \&onInput ) ;

  my $addr2 = Wx::IPV4address->new;
  $addr->SetHostname( 'localhost' );
  $addr->SetService( 4444 );
  $sock->SendTo( $addr, "123456\n", 7 );

  $this->{TEXT}->AppendText("-------------------------\n") ;
}

sub onInput {
  my ( $sock , $this , $evt ) = @_ ;
  my $buf = '#BEGIN#' ;
  my $addr = Wx::IPV4address->new;
  while( $sock->RecvFrom( $addr, $buf , 1000 ) ) {
    if ($buf =~ /\n$/s) { last ;}
  }
  $this->{TEXT}->AppendText($buf."#END#") ;
  $sock->Destroy;
}

package main;

  my( $app ) = MyApp->new();
  $app->MainLoop();

exit ;

# Local variables: #
# mode: cperl #
# End: #