LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2006, 11:58 PM   #1
anamericanjoe
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 16
PHP UNIX Domain Socket Programming


I am new to socket programming. I would like to program a PHP script to open up a UNIX domain socket (AF_UNIX) to communicate with another program running on the system. I've Googled to see how to accomplish this, however all I can really find are examples of internet sockets (AF_INET) for simple TCP/IP programs.

Can anyone help me figure out UNIX sockets with PHP or direct me to a good reference for UNIX sockets with PHP?
 
Old 12-07-2006, 05:34 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You might find starting here to be useful, there's at least 1 example of AF_UNIX plus plenty of links to defs/examples.
http://au2.php.net/manual/en/ref.sockets.php

Incidentally, I wrote a system that runs 24/7 with co-operating processes and had probs making UNIX sockets robust/graceful enough in error handling, so used INET sockets instead and it works just fine. (Actually in Perl, but the principles are the same).
YMMV ...
 
Old 12-08-2006, 02:10 AM   #3
anamericanjoe
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by chrism01
You might find starting here to be useful, there's at least 1 example of AF_UNIX plus plenty of links to defs/examples.
http://au2.php.net/manual/en/ref.sockets.php
This is one of the pages that turned up in my Google search. I think the TCP/IP client/server examples are handy for learning the AF_INET way of doing things, but I was hoping to see an example that uses AF_UNIX. (I searched the page for an example that uses AF_UNIX instead of AF_INET but couldn't find one...may you're seeing something I'm not?)

Quote:
Originally Posted by chrism01
Incidentally, I wrote a system that runs 24/7 with co-operating processes and had probs making UNIX sockets robust/graceful enough in error handling, so used INET sockets instead and it works just fine. (Actually in Perl, but the principles are the same).
YMMV ...
Coincidentally, I would like to pass messages between a php process and a perl process. What sorts of issues did you face with UNIX sockets that were solved by switching to INET sockets?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unix/socket programming, which book should i read first ??? b0nd Linux - General 2 05-06-2006 12:47 AM
connection between java socket and unix socket sathishkumar Programming 1 01-10-2006 03:21 PM
unix domain socket: how to know if i use recvmsg or read Thinking Programming 3 09-23-2005 01:51 AM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
Unix socket programming - how to sent a file Scrag Programming 9 03-28-2004 09:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration