note 124280 deleted from function.socket-connect by cmb

From: Date: Thu, 10 Oct 2019 06:23:46 +0000
Subject: note 124280 deleted from function.socket-connect by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212568@lists.php.net to get a copy of this message
Note Submitter: MartinNL ---- Hello, I have an issue with the socket_connect When I hard code a connection like: if(!socket_connect($sock , '192.168.1.53' , 10000)) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); } Everything works liek a charm. But when I want to use variables before all functions etc, then I get connection errors and well it doesn't work. $address = '192.168.1.53'; $port = 10000; if(!($sock = socket_create(AF_INET, SOCK_STREAM, 0))) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Couldn't create socket: [$errorcode] $errormsg \n"); } if(!socket_connect($sock , $address , $port)) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); } I have tried intval, int etc but that doesnt seem to help, what am I missing?

« previous php.notes (#212568) next »