[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Socket Programming




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.