function channel_create_stdapi_net_udp_client($req, &$pkt)
 {
     my_print("creating udp client");
     $peer_host_tlv = packet_get_tlv($req, TLV_TYPE_PEER_HOST);
     $peer_port_tlv = packet_get_tlv($req, TLV_TYPE_PEER_PORT);
     # We can't actually do anything with local_host and local_port because PHP
     # doesn't let us specify these values in any of the exposed socket API
     # functions.
     #$local_host_tlv = packet_get_tlv($req, TLV_TYPE_LOCAL_HOST);
     #$local_port_tlv = packet_get_tlv($req, TLV_TYPE_LOCAL_PORT);
     $sock = connect($peer_host_tlv['value'], $peer_port_tlv['value'], 'udp');
     my_print("UDP channel on {$sock}");
     if (!$sock) {
         return ERROR_CONNECTION_ERROR;
     }
     #
     # If we got here, the connection worked, respond with the new channel ID
     #
     $id = register_channel($sock);
     packet_add_tlv($pkt, create_tlv(TLV_TYPE_CHANNEL_ID, $id));
     add_reader($sock);
     return ERROR_SUCCESS;
 }
Example #2
0
 case "dev-op":
     if (is_gm() == True) {
         /*foreach ($player_data as $account => $data)
           {
             $n=count($player_data[$account]["units"]);
             for ($i=0;$i<$n;$i++)
             {
               $player_data[$account]["units"][$i]["movement"]=$unit_movement[$player_data[$account]["units"][$i]["type"]];
             }
           }*/
         $irciv_data_changed = True;
     }
     break;
 case "register-channel":
     if (is_gm() == True) {
         register_channel();
     }
     break;
 case "flush-channel":
     if (is_gm() == True) {
         flush_channel($dest);
     }
     break;
 case "save-data":
     if (is_gm() == True) {
         irciv_save_data();
     }
     break;
 case "load-data":
     if (is_gm() == True or $cmd == "INTERNAL") {
         irciv_load_data();