Report this

What is the reason for this report?

Fsockopen UDP connection problem

Posted on May 13, 2017

I am currently developing an APP that makes A UDP connection to another host to send commands (old quake3 engine game server) so you can moderate your gameserver without having to boot the game up on your pc.

I’m using laravel (overkill, but I’m learning the framework as well) and locally it works just fine, I can send the command and retrieve the message just as i want it to be. Now when deploying, the app doesn’t seem to work anymore, it doesn’t send any commands and I can’t seem to debug that, udp doesn’t have status (sometimes shows it connected even though the host is dead) so I’m running out of ideas, the firewall is set-up to allow outgoing UDP/TCP connections(I’ve tried with the firewall disabled as well) to the port I’m sending commands to (29070) and when asking the support about any possible blocking they said no. As you guys are probably way more experienced than me, is this a PHP problem or a VPS one?

$this->fp = fsockopen($this->host, $this->port, $this->errno, $this->errstr, 5);
        socket_set_timeout($this->fp, 5);   

and if I do

if ($this->fp)
    echo 'sucess';

It echoes out sucess, but you can’t really trust that when it comes to UDP connections.

How should I proceed?

Thanks.

ps used lemp and lamp on ubuntu 16.04

also I’ve looked around for another laravel host service and none of them accept outgoing and/or incoming UDP connection, which kill’s my application, so if any of you have any ideas please share, i’m desperate.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.