Hi Alexander, the mi_datagram is not broken (and never was). you can run a very simple test with NC (network commander): > echo -e ":uptime:\n\n"| nc -u 192.168.2.1 5059
About you php code I cannot comment as I'm not a php programmer :) Regards, Bogdan Alexander wrote: > Hi all! > > I try to get data from OpenSIPS via mi_datagram module. > > In opensips.cfg I set: > > loadmodule "mi_datagram.so" > modparam("mi_datagram", "socket_name", "udp:192.168.2.1:5059 > <http://192.168.2.1:5059>") > modparam("mi_datagram", "children_count", 3) > > Ok, OpenSIPS starts and listens port 5059. > > Then I try to get some data with PHP. For example: > > $command = ":uptime:\n\n"; > > $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); > $ret = ""; > $from = ""; > $port = ""; > > if ($socket) > { > // socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" > => 0, "usec" => 50000)); > > socket_sendto($socket, $command, strlen($command), 0, > '192.168.2.1', 5059); > > while ((socket_recvfrom($socket, $ret, 10, 0, $from, $port))) > { > // echo "Received from $from, port $port\n"; > echo $ret; > } > } > > But this code hangs after receiving first 10 bytes. If I set large > buffer (65535 bytes instead of 10 bytes), whole reply is received > properly. > > So, is it my bug in PHP script? Or OpenSIPS doesn't work correctly > with UDP? I've read that UDP support in mi_datagram is broken. Is it > still true? > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users@lists.opensips.org > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > -- Bogdan-Andrei Iancu www.voice-system.ro _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users