Re: restructuring/rewriting parts of networking code
| From: | Zeev Suraski | Date: | Tue, 08 Aug 2000 20:43:13 +0000 |
| Subject: | Re: restructuring/rewriting parts of networking code | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-28142@lists.php.net to get a copy of this message | ||
Since the alternative is not an option anyway, I'd go with one step at a time. Just make sure that the steps you make are complete, as in, if at some point you stop making further steps - PHP won't be in a messed up state.
Zeev
At 23:35 08/08/2000, Stig Venaas wrote:
Hi all I've looked through the networking code and done some thinking. I would like to implement a function hostconnect that takes the arguments hostname (or IP-address as string), protocol (TCP/UDP), blocking/noblocking and timeout. It returns a socket. As a special case it should also do domain sockets if hostname starts with /. I guess I also need a last argument for returning error-messages. The reason I want to have hostconnect, is that one hides away the address dependent parts, and one can inside hostconnect loop through all the available addresses of a host until one connects successfully. It can easily be implemented using getaddrinfo on platforms that support it, I'll do something else for those that don't. The places I've found networking code are: main/fopen-wrappers.c win32/sendmail.c ext/ftp/ftp.c ext/hyperwave/hg_comm.c ext/standard/dns.c ext/standard/fsock.c ext/mysql/libmysql/libmysql.c ext/mysql/libmysql/my_pthread.c I think all but my_pthread.c and dns.c can make good use of hostconnect, making them completely protocol independent. The code will be cleaner too. dns.c uses several resolver functions, I would like to do those afterwards, don't think I need to plan all those yet, would like to discuss them later. I need to check my_pthread.c later too. There is one thing in ftp that need to be solved later, and that's the handling of active ftp, I might have to make a combined bind-listen or something, but I think that can be done independently from hostconnect too. The hostconnect is very much the same as the internals of the fsockopen function. So, what I would like to do for starters is to implement a basic version of hostconnect with enough functionality that I can use it inside php_fopen_url_wrap_http (and php_fopen_url_wrap_ftp). I can get back to you when I've implemented that, and add it to the CVS after you've had a look at it. I kinda like doing one step at the time. Partly because I've only got time to do this in between other things, and it's good to get things tested as I go. Does this sound okay, or do you really think I should plan the entire wrapper API before I start? Stig -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net-- Zeev Suraski <zeev@zend.com> http://www.zend.com/