Forum Moderators: coopster
# send P_SET_BOARD packet (15)
vec($line, 0, 8) = 0x0f; # board_id packet
vec($line, 1, 8) = $board_id >> 24;
vec($line, 2, 8) = ($board_id>>16) & 0xff;
vec($line, 3, 8) = ($board_id>>8) & 0xff;
vec($line, 4, 8) = $board_id & 0xff;
vec($line, 5, 8) = 0; # high byte of password length
vec($line, 6, 8) = 0; # low byte of password length
syswrite SOCKET, $line, 7;
# Read the 1-byte response from server:
# 16 = P_ENTER_BOARD (followed by 2-byte integer giving number of users,
# followed by other data about the board
# 17 = P_ERROR (followed by string)
# 18 = P_TOO_MANY_USERS
sysread(SOCKET, $line, 1);
if (vec($line, 0, 8) == 0x10)
{
# Read number of users
sysread(SOCKET, $line, 2);
my $users = vec($line, 0, 16);
print $users;
}
The sysread/write stuff I can figure out, but I haven't a clue what to do with the vec stuff. Could someone please help. I don't have perl and don't even know how to run it on our server to see what the results of the vecs are.
Help, please,
Adam
And I'm guessing vec is just converting the $board_id number to hex...
But I'm a bit confused because my board_id is in the 90,000's so it would require a 32bit since it's just beyond 16bit.
It looks like it's only working with 1 byte, I think.
I'm still lost, but I'm really trying here... heh.