1

Wialon IPS Retranslator Packet Sending Probloem

Topic: Wialon IPS Retranslator Packet Sending Probloem

hello gurtam team , i'm developed server which can listen port and receive data from Client... also i have packet sender (client side program it works fine)... now i retranslated data from wialon IPS retranslator.... LogIn request is coming and i give him answer (i'm using IPS EMULATOR for testing) but after answer i'm trying send #SD# packet but server can't receive it...(but if i send same #SD# data from my client side program it works fine)... what can i do? please response me


//Socket Create
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $addr, $port) or die('Could not bind to address'); //Binding
socket_listen($sock); 

do{
$client = socket_accept($sock);
$input = socket_read($client, 1024);
if($input == "exit"){ //For turning off server
socket_close($client);
socket_close($sock);
$con = 0;
}
else{
//X=777*Y=777;
//#AL#1\r\n

echo $input."<br>";
if(substr($input,0,3)  == "#L#"){ //answer For Login packet
$request = "#AL#1\r\n";
socket_write($client, $request, strlen ($request)) or die("Could not write output\n");
}

if(substr($input,0,4)  == "#SD#"){ //answer For #SD# date packet
$request = "#ASD#1\r\n";
socket_write($client, $request, strlen ($request)) or die("Could not write output\n");
}


}



}while($con == 1);
Великий и ужасный Гиоргий Каладзе
2

Wialon IPS Retranslator Packet Sending Probloem

(edited by pese 19/02/2013 13:39:42)

Re: Wialon IPS Retranslator Packet Sending Probloem

I am not special php. And I don't know, as write server on php. But I can describe logic work server.

1. Open a socket to listen
$lsock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($lsock, $addr, $port) or die('Could not bind to address'); //Binding
socket_listen($lsock);
2. Further accept client
$csock = socket_accept($lsock);
Once the client has established a connection, create a client thread / process and read the data in a loop.
do {
  $input = socket_read($csock, $size);
  // TODO
} while(true)

3. Waiting next client connection.

My opinion is to write a server, you need a deeper understanding of sockets, processes, threads. You can read the necessary literature.

3

Wialon IPS Retranslator Packet Sending Probloem

Re: Wialon IPS Retranslator Packet Sending Probloem

unitedsecurity

Hola estimado tendrías ejemplo de como analizar los paquetes recibidos para linux

Hello dear example of how you would analyze packets received for linux