LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-20-2006, 05:21 AM   #1
navaburo
LQ Newbie
 
Registered: Mar 2006
Posts: 16

Rep: Reputation: 0
Sending data to a process along an already open stream.


How does one go about sending data to a process along an already open stream. For instance,

in one terminal:
cat /dev/ttyS0

and then in another terminal:
foobar .... "RING"

(where foobar is some command such that cat will output RING)

At first glance, you would say to use echo "RING" > /dev/ttyS0 , however this sends data
to /dev/ttyS0. I need to send data to the PROCESS reading /dev/ttyS0.

The reason I want to do this is so that i can get mgetty to answer a call without a real ring from the modem (since the call is coming in localy over a telephone line simulator).

Other options I have concidered and am open to suggestion on:
* special configuration of mgetty
* modifying the mgetty source (gulp)
* creating some kind of special device (like a two-way fifo buffer) that can act as a middle man between mgetty and the modem (call it /dev/fakemodem), and then using echo to send charicters as if they were coming from the modem.

Here is a lsof output while cat /dev/ttyS0 is running....

cat 8907 navaburo cwd DIR 8,5 4096 310117 /home/navaburo
cat 8907 navaburo rtd DIR 8,5 4096 2 /
cat 8907 navaburo txt REG 8,5 16504 652802 /bin/cat
cat 8907 navaburo mem REG 8,5 90248 750739 /lib/ld-2.3.2.so
cat 8907 navaburo mem REG 8,5 1254468 1175052 /lib/tls/libc-2.3.2.so
cat 8907 navaburo mem REG 8,5 290576 1550478 /usr/lib/locale/locale-archive
cat 8907 navaburo 0u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 1u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 2u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 3r CHR 4,64 2633 /dev/ttyS0

the last line should give enough information to do this, I just donot know how!


Thanks so much in advance.
 
Old 03-18-2007, 06:51 PM   #2
navaburo
LQ Newbie
 
Registered: Mar 2006
Posts: 16

Original Poster
Rep: Reputation: 0
Solution

I ended up modifying the mgetty source code to look for the existence of a special file called RING in my home directory. When it sees the file, it acts as if it got a RING code from the modem and deletes the file. The connection works fine. To simulate the ring i type touch ~/RING
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sending a signal to a process (Help me) rajesh_b Programming 2 09-17-2004 01:30 AM
Sending data from one server to the other ganninu Linux - General 6 12-10-2003 06:06 AM
Sending data over ppp shibdas Linux - Networking 0 06-26-2003 12:40 PM
sending process to background Robert0380 Linux - General 5 12-31-2002 03:33 PM
Sending a process a HUB robeb Linux - General 3 06-12-2002 11:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12: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