MESSAGE
DATE | 2005-02-12 |
FROM | From: "Martin, Jared"
|
SUBJECT | Re: [hangout] Monitoring input in simple chat exercise.
|
Well perhaps getting my feet wet isn't the best way to word it, but I'm already familiar with other programming languages and I'm well beyond hello world and scanf. This is the first program I've done in c (besides hello world). I've gotten warmed up to the use of pointers and strings even passing functions as parameters (nice!) I've actually figured out this very question, I can just use the stdin fd 0 in my select and then read with read. This wouldn't work for some reason the first time, but I've got it now. I actually find that I learn better by jumping in and trying to do what I've already done in other languages in this one. That's the way I learned spanish too, total immersion.
I'd really love to taker one of the classes, but no one is willing to tell me how much it costs! Well, thanks for your help.
Sincerely, ***************************** Jared Martin IT Desktop Support Davis & Gilbert LLP 1740 Broadway New York, NY 10019 Help Desk: 212-237-1500 Office: 212-237-1504 Cell: 646-773-4138 Fax: (212) 974-7023 *************************************
-----Original Message----- From: Ruben Safir To: Billy CC: Martin, Jared ; hangout-at-nylxs.com Sent: Fri Feb 11 22:12:10 2005 Subject: Re: [hangout] Monitoring input in simple chat exercise.
This is an INSANE WAY to get your "feet" wet in C...
Maybe Hello Word and learning the ins and outs of scanf is a good start.
When you go to a movie, do you always come in during the final 20 minutes?
Ruben
On Fri, 2005-02-11 at 19:32, Billy wrote: > Martin, Jared wrote: > > I'm working on creating a simple chat program to get my feet wet in c. > > > > I've been told its better to avoid threads, so I'm using select to monitor > > multiple connections from clients. > > > > How do I get the client to check for new data on both the network conn as > > well as input from the user without having one block the other? > > Should I use select on the client too or is there a better way of doing it. > > > > Perhaps recv with peek would work to check the socket, but I've not yet > > figured out how to receive input from the user without blocking and without > > checking for individual keystrokes. > > > > Suggestions/Links/Code would be very greatly appreciated. > > select will do it, but you probably also need to configure the terminal. > You will have to use tcsetattr to setup. > > You need to clear the ICANON and ECHO cflag, > You can to set c_cc[VMIN]=1 and c_cc[VTIME]=0. > > It's all explained here: > http://www.delorie.com/gnu/docs/glibc/libc_372.html > > Your client program will probably work best as a loop > doing select() on both the input terminal and the > server connection socket. > ____________________________ > NYLXS: New Yorker Free Software Users Scene > Fair Use - > because it's either fair use or useless.... > NYLXS is a trademark of NYLXS, Inc >
____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|