-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socket server need to restart on day start #259
Comments
You mentioned at #203 (comment) that his happens at midnight? What happens at midnight on that server and with your application? Aside from that this code looks fine, What is happening at |
I've found what exactly happen.
o |
@kailasb10 you mean the IP of the server changes? or is the IP still the same but your socket server isn't listening to the unchanged IP? |
I'm requesting 192.168.0.50:8080 but on the server, it's set to 127.0.0.1:8080 that's why it's not communicating may be getHostByName(getHostName()); this line gives the local IP. So I've changed in server.php file to create a connection with 0.0.0.0:8080 it's will start communicating with any IP address. |
So you say (react)php looses the IP binding at some point in the process? Switching to the wildcard IP 0.0.0.0 is a workaround but doesn't solve the actual problem. Just to be on the same page.
|
yes |
AFAIK that's not possible ;-) Does your server loose the IP or network connect at some point? or maybe use DHCP? |
That is a very good point! No clue how the socket server behaves what it expires, that would also depend on the network stack of the OS. But I wouldn't be surprised if it would fall back to the loopback interface and bind on Also, if you lose that IP, an active connection might be dropped no matter how long. I kinda assumed you had a very good reason to go for a specific IP, but otherwise use |
I've observed that this will happen when the server restart. I think when we get NULL IP address then it points to local IP (127.0.0.1) address |
Thanks for you answer. It looks like that's a completely different scenario compared to my understanding of you description. In this case I would expect ReactPHP (actually the underlying layers down to the kernel) behaves correctly. At point in time when your application starts you get the IP that exists in the system which is at least localhost. That means you application starts too early. I don't know which supervisor you use, I can only suggest to change the start dependencies the way your application is started after the network stack is ready. The good thing is that is not a ReactPHP issue 😅 |
yes. It's not ReactPHP issue :) |
I've created the server in laravel command file & set in supervisor to run the socket server continuously to accept client msg
Laravel Command file code
Server.php
Client.php
This is working fine but when I check on the next day it will be sent data from Client.php but not received at Server.php Then restart Supervisor of Server.php / php artisan server then it working fine for the whole day
The text was updated successfully, but these errors were encountered: