Replies: 2 comments 2 replies
-
You should check that $sp is not false, before you enter the while loop. I don't think that the resource ($sp) will ever change to false. Even if the connection is lost. You should instead check if the write operation succeed.
If it fails, you should re-initiate the connection, by closing and opening the connection. Please let me know if this helps? |
Beta Was this translation helpful? Give feedback.
1 reply
-
This is the updated code. Again, thank you so much!
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have this code where it will always create a new connection to the server.
But obviously this is creating a new connection over and over again.
I'm wondering how I can make this more efficient.
This code doesn't work as intended unless the initialization of
$sp
is within the while loop. but then we get the problem of thousands of new connections.Beta Was this translation helpful? Give feedback.
All reactions