At 12:53 PM 10/26/2006 -0300, Alejandro Santillan wrote:
>Thanks Rob. I think that my problem is just the terminator character, but on
>the string sent by the server, and not mine.
U should be able to manually telnet to the port and do the transaction by
just typing/pasting the string. Does that work? Does the proper response
show up on the screen?
>#1. This failed miserably. The program hanged indefinitely
># @answerfromserver=<$handle>;
>#$answerfromserver=join "",@answerfromserver;
>#print $anserfromserver;
If there was no new line sequence transmitted by the other end then this
would fail. Remember that <> is the line input operator. It won't fire
until it sees that new line on the input. undef'ing $/ might make it work.
>#2. This failed also miserably. The program hanged indefinitely
>#my $byte;
># while (sysread($handle, $byte, 1) == 1) {
># print $byte;
># }
That should have worked, since it's essentially the same as ur try #3.
Maybe declaring binmode on $handle would make a difference. Perhaps some
unicode strangeness is going on.
>#3. This worked, after several tries when I gess correctly the right length
>of the answer to be 55 bytes!!!
>for($i=0;$i<57;$i++){
>sysread($handle,$byte,1);
>print $byte;
>}
I noticed in ur original code that ur reading and writing to the same
handle. According to perldoc mixing print's and sysread's on the same
handle is a no-no. That's because they're using different I/O schemes which
can collide. Have u tried it with a normal read? "Conventional wisdom" has
it that sysread's should only be used with syswrite's. $return = read
$handle, $buffer, 999999; should give u what u want.
--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"
00000100
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs