[ale] Socket Programming
Bao C. Ha
baoha at sensoria.com
Tue Jun 5 11:52:41 EDT 2001
Have
you tried to open it with O_NOCTTY also?
<SPAN
class=525445015-05062001>Â
open(argv[1], O_RDWR<SPAN
class=525445015-05062001> | O_NOCTTY)
<SPAN
class=525445015-05062001>Â
<SPAN
class=525445015-05062001>It prevents a break to kill the session. It is
Unix thing and
<SPAN
class=525445015-05062001>I don't know if it works with win32 or
not.
<SPAN
class=525445015-05062001>Â
<SPAN
class=525445015-05062001>Bao
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">
<FONT face=Tahoma
size=2>-----Original Message-----From: owner-ale at ale.org
[mailto:owner-ale at ale.org]On Behalf Of Chris FowlerSent:
Tuesday, June 05, 2001 8:36 AMTo: 'Vernard Martin'Cc:
'ale at ale.org'Subject: RE: [ale] Socket
Programming
Vernard,
You know much about Win32 programming?
I need to sucessfully run this piece of UNIX OK code in
winbloze /* terminal.c <FONT
size=2>Â * Â *Â Small program to allow
running of an excutable  * <FONT
size=2>Â *Â Arguments: <FONT
size=2>Â *Â Â Â Â Â
       argv[1]: PORT to be input and
output  *    Â
       argv[2]: Console application to
execute on the serial port defined  *
 */  Â
#include <fcntl.h> <FONT
size=2>#include <stdio.h>
int main(int argc, char
*argv[]) {
      Â
       int fd;
      Â
       /* check arguments
*/ Â Â Â Â Â Â Â
       if(argc != 3)
      Â
       {
      Â
      Â
       printf("terminal
[serial port] [command shell to execute]\n");
      Â
      Â
       exit(1);
      Â
       }
      Â
      Â
      Â
       /* Open Serial Port
*/ Â Â Â Â Â Â Â
       if((fd = open(argv[1],
O_RDWR)) == -1) Â Â Â Â Â Â Â
       {
      Â
      Â
       perror("terminal: OPEN
COM"); Â Â Â Â Â Â Â
      Â
       exit(1);
      Â
       }
      Â
      Â
      Â
       /* Set STDIN, STDOUT,
STDERR to the serial port */
      Â
       dup2(fd, 0);
      Â
       dup2(fd, 1);
      Â
       dup2(fd, 2);
      Â
       /* Execute the command
specified */ Â Â Â Â Â Â Â
       execl(argv[2],argv[2],
0); Â Â Â Â Â Â Â
      Â
      Â
       /* If we are here,
there is an issue! */ Â Â Â Â Â Â Â
       <FONT
size=2>perror("terminal");
      Â
       return 1;
}
What happens:
cmd.exe comes across COM1. But, on terminal, I can not
type anything and it appears that cmd.exe has
terminated. Sorry for the windows post.
Any help would be appreciated.
Thanks, Chris
-----Original Message----- From:
Vernard Martin [<A
href="mailto:vernard at cc.gatech.edu">mailto:vernard at cc.gatech.edu]
Sent: Tuesday, June 05, 2001 11:07 AM <FONT
size=2>To: Fulton Green Cc: Terry Lee Tucker;
ale at ale.org Subject: Re: [ale] Socket
Programming
> When I was learning sockets back in '98, I found the book
_Beginning Linux > Programming_ to be invaluable
for a quick start. Then I got the _UNIX > Network
Programming_ book by Richard Stevens to go more in-depth.
By far the most in-depth book for doing any unix network
programming is the Stevens book. A must have book in
my library.
V -- Vernard
Martin (vernard at cc.gatech.edu) <A href="http://www.cc.gatech.edu/~vernard/"
target=_blank>http://www.cc.gatech.edu/~vernard/Â Â Â Â
       "Anything
worth fighting over is worth fighting dirty over" <FONT
size=2>-- To unsubscribe: mail majordomo at ale.org with
"unsubscribe ale" in message body.
More information about the Ale
mailing list