[ale] Socket Programming
Chris Fowler
ChrisF at computone.com
Tue Jun 5 11:35:39 EDT 2001
Vernard,
You know much about Win32 programming?
I need to sucessfully run this piece of UNIX OK code in winbloze
/* terminal.c
 *
 * Small program to allow running of an excutable
 *
 * Arguments:
 *            argv[1]: PORT to be input and output
 *            argv[2]: Console application to execute on the serial port defined
 *
 */
 Â
#include <fcntl.h>
#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! */
              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 [mailto:vernard at cc.gatech.edu]
To: ale at ale.org
Sent: Tuesday, June 05, 2001 11:07 AM
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) http://www.cc.gatech.edu/~vernard/Â Â Â Â
       "Anything worth fighting over is worth fighting dirty over"
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
More information about the Ale
mailing list