|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8283 Impossible to connect to socket made by other unix daemon...
Submitted: 2000-12-15 15:04 UTC Modified: 2001-03-06 06:57 UTC
From: roman at loveme dot spb dot ru Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.3pl1 OS: FreeBSD 4.1-STABLE
Private report: No CVE-ID: None
 [2000-12-15 15:04 UTC] roman at loveme dot spb dot ru
After creating local Unix (AF_UNIX) socket using other program daemon PHP script with function connect() is not able connect to this socket.

'./configure' '--prefix=/usr/local' '--with-system-regex' '--with-apache=/usr/ports/www/apache13-php3/work/apache_1.3.12' '--with-config-file-path=/usr/local/lib' '--disable-debug' '--enable-track-vars' '--with-gd=/usr/local' '--with-zlib' '--with-mysql=/usr/local' '--with-pgsql' '--with-ndbm' '--enable-wddx' '--includedir=/usr/local' '--enable-sockets'

PHP program text:

$sockfd=socket(AF_UNIX, SOCK_STREAM);
connect($sockfd, "/tmp/my_sock.sock");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this cause the error

FreeBSD program:

main() {

	struct sockaddr_un  serv_addr;
    	int                 addrlen, old_umask;
        int sockfd, ns;

	sockfd=socket(AF_UNIX, SOCK_STREAM, 0);


    	bzero(&serv_addr, sizeof(serv_addr));
    	strcpy(serv_addr.sun_path, "/tmp/my_sock.sock");
    	bind(sockfd, (struct sockaddr *)&serv_addr, addrlen);
    	listen(sockfd, MAX_USERS);
  	ns=accept(sockfd, (struct sockaddr *)&clnt_addr, &addrlen));



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-19 06:34 UTC]
Works for me on Linux.
Note that socket accepts three parameters (0 for the third
should be a safe bet).

If it doesn't work for you still, please describe which
errors it gives (result codes of socket and connect).
 [2001-03-06 06:57 UTC]
No feedback, closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 22:01:32 2024 UTC