LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-09-2005, 09:36 AM   #1
Peterius
Member
 
Registered: May 2004
Distribution: Gentoo, Debian, OpenBSD, NetBSD
Posts: 158

Rep: Reputation: 16
Question PF_UNIX C perl


I'm trying to get a C program and a perl program to communicate over PF_UNIX local sockets, partly just because I've never done this before. I use sockaddr_un("name_of_file") and then connect
and I use print SOCK "data\n"; to send data. On the C side I'm using socket(PF_UNIX, SOCK_STREAM, 0), listening and then accepting the connection and there's a select loop to actually read the data.

The C program accepts the connection with no errors and then just sits there. It never reads the data. The perl program sends the data but then it just sits there, blocking on read. (The C program sends a response after it receives the data). There are no error messages and if I Ctrl-C the perl program, then the C program gets an MSGPIPE or whatever for a broken connection. But if I don't they just sit there indefinitely. At first I thought this was the perl programs fault, but it is sending the data according to it. The print statement doesn't die or anything, its blocking on the $line = <SOCK>; Then I thought it was the C program, but it does properly accept the connection. I'm wondering if anyone else has done anything like this and has some insight.

My second issue is that there is supposedly an abstract namespace for PF_UNIX sockets thats accessed by prefacing the name of the socket with a null. I don't want there to be a file, just a name in the socket namespace. Is perl okay with such things or is there a special better way to do this? I must have SOCK_STREAM because I need the C server to handle multiple such local connections simultaneously, not just one.
 
  


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
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
Hiding code in PERL, perl gui question randomx Programming 1 06-26-2004 03:22 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM
can i set ~/public_html/perl as a perl directory for apache? doublefailure Linux - Networking 1 07-09-2002 04:31 PM

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

All times are GMT -5. The time now is 05:28 PM.

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