View Full Version : unable to get IS_ISI (ISP_ISI) to work
Krammeh
7th June 2007, 17:39
Unable to get the insim init packet to work with the new insim version,
connects okay, and can send data. I try and send this
$packet="";
$packet=pack("c", "44");
$packet.=pack("c", "ISP_ISI");
$packet.=pack("c", "1");
$packet.=pack("c", 0);
$packet.=pack("S", $localport);
$packet.=pack("S", "16+32");
$packet.=pack("c", 0);
$packet.=pack("c", 0);
$packet.=pack("c", 0);
$packet.=str_pad($adminPW, 16, "\0");
$packet.=str_pad("LTC Insim", 16, "\0");
fwrite($sender, $packet, strlen($packet));
and, LFS just complains about incorrect packet size, and incorrect byte on first packet.
Using UDP btw.
filur
7th June 2007, 17:46
"ISP_ISI" should not go in the packet, you're supposed to send the value of the constant ISP_ISI.
define('ISP_ISI', 1); // 1 - instruction : insim initialise
Krammeh
7th June 2007, 17:48
oooh I see.
Thanks :)
Krammeh
7th June 2007, 17:51
it still complains about an incorrect packet size.
Victor
7th June 2007, 17:52
i wonder if that's correct : $packet.=pack("S", "16+32");
shouldn't that be : $packet.=pack("S", 16+32);
Krammeh
7th June 2007, 17:53
even with it as $packet.=pack("S", 16+32);, it still complains :|
Victor
7th June 2007, 17:59
$localport = 12345;
$packet = "";
$packet .= pack("c", 44);
$packet .= pack("c", 1);
$packet .= pack("c", 1);
$packet .= pack("c", 0);
$packet .= pack("S", $localport);
$packet .= pack("S", 16+32);
$packet .= pack("c", 0);
$packet .= pack("c", 0);
$packet .= pack("S", 0);
$packet .= str_pad($adminPW, 16, "\0");
$packet .= str_pad("LTC Insim", 16, "\0");
echo strlen ($packet);
you had a CHAR for Interval where it should be a Short, so your packet was 43 bytes instead of 44
Krammeh
7th June 2007, 18:02
okay, it connects now. thanks a lot!!!
Victor
7th June 2007, 18:11
btw, i think you chould write C's for all your c's too - those bytes should be unsigned (C) instead of signed (c)
Krammeh
7th June 2007, 18:12
they are lowercase...?
Victor
7th June 2007, 18:17
oops typo in second half of my sentence
Krammeh
7th June 2007, 18:18
so it should be C and not c?
Victor
7th June 2007, 18:21
yep,
a byte is unsigned. Uppercase C is the unsigned byte (char) indication for the pack() function.
http://nl2.php.net/manual/en/function.pack.php
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.