Questions tagged [php-socket]

PHP comes with a very capable socket programming API. These socket functions include almost everything you would need for socket-based client-server communication over TCP/IP, and can be easily deployed to build simple network applications.

More info here: https://php.net/manual/en/book.sockets.php

96 questions
0
votes
1 answer

Socket accept gives error when I add socket_set_nonblock

My code worked fine, but when I changed and added socket_set_nonblock($socket) socket_accept gave me error 11, here is my code
Sevada 797
  • 346
  • 1
  • 8
0
votes
0 answers

PHP Socket management

I have been trying PHP Sockets lately. I could use some help understanding a few things. Once I start a socket and begin listening: socket_server.php: socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($socket, $host, $port);…
TV-C-1-5
  • 680
  • 2
  • 13
  • 19
0
votes
2 answers

Too many sockets open by cURL multi

I am using cURL multi to get data from some websites. With code: function getURL($ids) { global $mh; $curl = array(); $response = array(); $n = count($ids); for($i = 0; $i < $n; $i++) { $id = $ids[$i]; $url =…
0
votes
0 answers

Uncaught Error: Undefined constant AF_NET - PHP Socket

*Hello everyone, I got AF_NET error using php socket. I try to found on multiple post, but all enable this extension=sockets or extension=php_sockets.dll in their php.ini and work. I enable both and separately on my php.ini of my XAMPP in Windows, I…
Julien Pepe
  • 142
  • 8
0
votes
1 answer

PHP connect as client to NodeJS Web socket

Need my laravel app to connect to a nodejs based socket server. The function needs to pass custom headers in order to authenticate as well as keep pinging the connection every 1 minute in order to prevent disconnection from the socket server Can…
maximus 69
  • 1,388
  • 4
  • 22
  • 35
0
votes
0 answers

Websocket handshake over SSL TIMEOUT

I have my website running on shared hosting over https(Using Let's Encrypt). It implements websocket using Ratchet as below $pusher = new qApp\Pusher; $loop = React\EventLoop\Factory::create(); // Listen for the web server to make a ZeroMQ push…
pushE
  • 394
  • 3
  • 16
0
votes
2 answers

PHP Websocket failed: Error during WebSocket handshake: net::ERR_CONNECTION_CLOSED (anonymous)

i learning the websocket in PHP but i don't know why have this handshake error. My client.html :