Hi!, i have a "server-like" application:
i use select to accept and recieve data from Sockets.
I want to Add a menu to this app something like "pick an option" thing,
but it has to show data according to data recieved from Sockets..
I found a way to do it with Fork, i mean, First i fork;in the Child i
do all the menu stuff and in the "else" part (the parent part) i have
the rest (the while(1) with a select inside). But i dont like this
because, i don't like forking just for a menu! and i have to create a
socket to communicate with the parent.
i was thinking.. isn't it possible to tell the select to read and show
the stdin, after all, it's a FD.
I tried this but i couldn't get it to work correctly, i ran into
trouble like "recv cant read from a Non-socket fd" "i read the stdin
with "read" but i reads char by char -i guess- and it remains "ready"
so select, keeps selecting stdin forever.
so, i don't know which is THE way to do it correcly if there is such a
thing.
Thanks. 3 3704 if*****@gmail.com wrote: Hi!, i have a "server-like" application: i use select to accept and recieve data from Sockets. I want to Add a menu to this app something like "pick an option" thing, but it has to show data according to data recieved from Sockets..
I found a way to do it with Fork, i mean, First i fork;in the Child i do all the menu stuff and in the "else" part (the parent part) i have the rest (the while(1) with a select inside). But i dont like this because, i don't like forking just for a menu! and i have to create a socket to communicate with the parent.
i was thinking.. isn't it possible to tell the select to read and show the stdin, after all, it's a FD. I tried this but i couldn't get it to work correctly, i ran into trouble like "recv cant read from a Non-socket fd" "i read the stdin with "read" but i reads char by char -i guess- and it remains "ready" so select, keeps selecting stdin forever.
so, i don't know which is THE way to do it correcly if there is such a thing.
This is the wrong group, we limit our discussions to Standard C here
which does not include sockets, forking, etc.; try
comp.unix.programmer.
Robert Gamble if*****@gmail.com wrote: Hi!, i have a "server-like" application: i use select to accept and recieve data from Sockets. I want to Add a menu to this app something like "pick an option" thing, but it has to show data according to data recieved from Sockets..
I found a way to do it with Fork, i mean, First i fork;in the Child i do all the menu stuff and in the "else" part (the parent part) i have the rest (the while(1) with a select inside). But i dont like this because, i don't like forking just for a menu! and i have to create a socket to communicate with the parent.
You probably want a newsgroup with 'restaurant' or 'dining' or
something like that in its name. This is comp.lang.c, which has
nothing whatsoever to do with menus, selecting therefrom, forks,
serving, sockets, parents. There is also a remote chance that
comp.unix.programmer would be useful.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chuck Anderson |
last post by:
Can anyone point me in the right direction? I want to use Php to
automate confirmation of someone joining an email list by them replying
to an email (so they don't have to have a browser?).
I...
|
by: Harayasu |
last post by:
Hi,
Using fgets() I can read from stdin and with fputs() I can write to
stdout. Now I have two programs, one writing to stdin and the other
one reading from stdin. And I would like the second...
|
by: Marcia Hon |
last post by:
Hi,
I am trying to use the select() socket programming command to select between
stdin and a connection. Currently, I have a listening stream and stdin that
I insert into the fd_set. The problem...
|
by: Charlie Zender |
last post by:
Hi,
I have a program which takes the output filename argument from stdin.
Once the program knows the output filename, it tries to open it.
If the output file exists, the program asks the user to...
|
by: asdsd sir |
last post by:
Hi!I'm new in Python and i'd like to ask some general questions about
stdin,stdout...
Firstly...
if we type like something like :
cat "file.txt"|python somefile.py
#somefile.py
import sys
|
by: bobano |
last post by:
Hi everyone,
I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol....
|
by: Dio |
last post by:
#!/usr/bin/env python2
from sys import stdin
from select import select
while 1:
(rr, wr, er) = select(, , )
for fd in rr:
print fd
|
by: timekeer9 |
last post by:
Hi,
I would like to poll stdin for input so I can get user input from the command line without blocking. Looking through the archives, it appears that the best way to do this is using a combination...
|
by: Samuel A. Falvo II |
last post by:
I have a shell script script.sh that launches a Java process in the
background using the &-operator, like so:
#!/bin/bash
java ... arguments here ... &
In my Python code, I want to invoke...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |