> use Socket; > my $serverip = "194.109.69.91"; > my $serverport = 27960; > my $getstatus = "\xFF\xFF\xFF\xFFgetstatus"; //THIS IS THE > LINE I'M HAVING PROBLEMS WITH IN LINUX BEING SENT > > $ipaddr = sockaddr_in($serverport, inet_aton($serverip)); > $protocol = getprotobyname("udp"); > > socket(SOCKET, PF_INET, SOCK_DGRAM, $protocol) or die "socket: $!"; > connect(SOCKET, $ipaddr) or die "connect: $!"; > send(SOCKET, "$getstatus\n", 0); > recv(SOCKET, $response, 65000,0); > print ($response); > > The weird thing is this works fine in windows and get a > response i want, and if I packet stuff whats sent out (from > $getstatus) the first part is FF FF FF FF which is fine, > problem is under Linux when I run the script and sniff the > packets going out it comes as c3 bf c3 bf c3 bf c3 bf. So > somehow its not converting what I've entered correctly? Must > be something obvious I'm missing? >
The data your are sending consists of string literal values which depend on the character set of the machine you are using. For instance, if I send "\x01\x01\x01" to a my windows machine through a socket, I get 3 ASCII smiley faces returned. If I send it to my linux box, I get " "/. You can pack the data into a template where you can specify the byte order of the data. Read up on: perldoc perldata (section on string literals) perldoc -f pack -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]