equal
deleted
inserted
replaced
1 package Quancom::Test::Server; |
1 package Quancom::Test::Server; |
2 |
2 |
3 # This package is for internal use only - for testing the |
3 # This package is for internal use only - for testing the |
4 # Quancom.pm module and should work like the real USB-OPTO device of |
4 # Quancom.pm module and should work like the real USB-OPTO device of |
5 # Quancom. |
5 # Quancom. |
|
6 |
|
7 # Quancom test/simulator server |
|
8 # Copyright (C) 2008 Heiko Schlittermann |
|
9 # |
|
10 # This program is free software: you can redistribute it and/or modify |
|
11 # it under the terms of the GNU General Public License as published by |
|
12 # the Free Software Foundation, either version 3 of the License, or |
|
13 # (at your option) any later version. |
|
14 # |
|
15 # This program is distributed in the hope that it will be useful, |
|
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 # GNU General Public License for more details. |
|
19 # |
|
20 # You should have received a copy of the GNU General Public License |
|
21 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22 # |
|
23 # Heiko Schlittermann <hs@schlittermann.de> |
6 |
24 |
7 use strict; |
25 use strict; |
8 use warnings; |
26 use warnings; |
9 use Carp; |
27 use Carp; |
10 use IO::Socket; |
28 use IO::Socket; |
164 |
182 |
165 return $retval . sprintf("%02x", unpack("%8C*", $retval)); |
183 return $retval . sprintf("%02x", unpack("%8C*", $retval)); |
166 } |
184 } |
167 |
185 |
168 1; |
186 1; |
|
187 |
|
188 __END__ |
|
189 |
|
190 =head1 NAME |
|
191 |
|
192 Quancom::Test::Server |
|
193 |
|
194 =head1 SYNOPSIS |
|
195 |
|
196 use Quancom::Test::Server; |
|
197 |
|
198 my $server = new Quancom::Test::Server "/tmp/socket"; |
|
199 $server->run(); |
|
200 |
|
201 =head1 METHODS |
|
202 |
|
203 =over |
|
204 |
|
205 =item constructor B<new>( I<$address> ) |
|
206 |
|
207 This creates a new server on the I<$address>. The I<$address> may be one |
|
208 of the following: |
|
209 |
|
210 "-" server communications on STDIN/STDOUT |
|
211 [address:]port server binds to port I<port> on address I<address> |
|
212 or 0.0.0.0 |
|
213 filename server creates and binds to the named socket |
|
214 file (the file gets created by the server and |
|
215 will be removed afterwards) |
|
216 |
|
217 =back |