navarr / Sockets

PHP Socket Classes
MIT License
50 stars 23 forks source link

Added run (timeout) parameter #8

Closed viniciusjarina closed 9 years ago

viniciusjarina commented 9 years ago

Used internally by the socket_select

viniciusjarina commented 9 years ago

@navarr ping

navarr commented 9 years ago

@viniciusjarina

Before I merge this - is there any benefit to having the timeout be a parameter instead of a configuration attribute on the class itself?

I say this because you're passing it around multiple functions through run() which means for the average use case it's only set once per implementation - in which case it would probably be better for it to be an attribute.

Thoughts?

viniciusjarina commented 9 years ago

Is up to you. :smile:

I think as parameter of run is quite straight forward. Since the run method block the execution, is a common pattern to have a timeout parameter of blocking functions (even in other languages like C#).

navarr commented 9 years ago

I refactored it into a configuration parameter (I think it looks cleaner - sorry about that).

Thank you very much for the code. You've been working harder on this project lately than I have. I imagine you're using it for something? Anything interesting?

viniciusjarina commented 9 years ago

I am using to do interop between PHP and Python :wink:

I have a library in PHP that I want to use from Python, so I've wrote a PHP server to do the calls and a client interface from Python. ;)

navarr commented 9 years ago

Neat! Thank you as always for pushing your changes and tweaks upstream :)

viniciusjarina commented 9 years ago

No problem :)

On Mon, Feb 23, 2015 at 2:15 PM, Navarr Barnier notifications@github.com wrote:

Neat! Thank you as always for pushing your changes and tweaks upstream :)

— Reply to this email directly or view it on GitHub https://github.com/navarr/Sockets/pull/8#issuecomment-75586752.