Schrift
[thread]4322[/thread]

socket / sysread - Probleme

Leser: 1


<< >> 3 Einträge, 1 Seite
esskar
 2005-02-28 17:55
#37902 #37902
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
perldoc -f ord
   ord EXPR
   ord     Returns the numeric (the native 8-bit encoding, like ASCII or
           EBCDIC, or Unicode) value of the first character of EXPR.


Quote
Don't use functions you do not understand!
If you don't understand WHAT are they doing, and how do control what are they doing, simply don't use them. You don't have to know HOW are they doing it, but if you don't feel you understand properly how to use them ... ask someone to help you with the code, let someone review the code, read the documentation ten more times or use something else
--Jenda Krynicky

;)\n\n

<!--EDIT|esskar|1109606148-->
Gast Gast
 2005-02-28 17:50
#37903 #37903
Hallo,
ich habe Probleme einen Hex-String von einer Socketverbindung zu lesen. Ankommen sollte z.B. "01 03 04 a0 ad 41 a4 78 39 "
...
my $buffer = "";
sysread(SOCK, $buffer, 1024, 0);
$buffer = ord($buffer);
print "$buffer \n";
...
so ich krieg aber nur den ersten Abschnitt zurück.
wir bring ich sysread dazu, auch den Rest auszulesen?
hat jemand ne idee?
Danke, Ratz
Relais
 2005-02-28 17:57
#37904 #37904
User since
2003-08-06
2246 Artikel
ModeratorIn
[Homepage] [default_avatar]
indem Du den sysread() - Aufruf wiederholst, zum Beispiel in einer while-Schleife.
Code: (dl )
while ( sysread( ... ) ){ print( ord( $buffer ), "\n" ) }
Erst denken, dann posten --
27. Deutscher Perl- u. Raku -Workshop (Termin wird noch gesucht) 2025 in München.

Winter is Coming
<< >> 3 Einträge, 1 Seite



View all threads created 2005-02-28 17:55.