Need help on program for serial line communication of UNIX

Need help on program for serial line communication of UNIX

Post by Elson Cha » Sat, 14 Feb 1998 04:00:00



I've been going to develop a C program to do the communication of a data
device to UNIX through a serial line.  My environment is Sun Solaris
2.4.  The communication is two-way.  The data device will response by
get request from UNIX through the line.

Can anyone give me a simple program to start with or suggestions or
guidelines.

Thanks

Elson Chan

 
 
 

1. Need help w/serial communication under interactive unix

I'm trying to do serial communication between a computer running dos and
one running Interactive Unix. The problem is that I can't find out how
to enable RTS/CTS (hardware) handshaking for the port.

This is the initialization code i use:

int com_init(void)
{
  struct termio tio;
  int rc;
  int com; /* Serial port file descriptor */
  com = open("/dev/ttyd0", O_RDWR);
  rc = ioctl(com, TCGETA, &tio);
  if (rc == -1)
    return 0;
  tio.c_cflag = B9600 | CREAD | CS8;
  tio.c_iflag = 0;
  tio.c_oflag = 0;
  tio.c_lflag = 0;
  tio.c_line = 0;
  rc = ioctl(com, TCSETA, &tio);
  if (rc == -1)
      return 0;
  tcflush(com, TCIOFLUSH);
  return com;

I first wrote this code for linux. Linux had a CRTSCTS flag which I
could set in tio.c_cflag to enable hardware handshaking. Unfortuately I
am forced to run the application under Interactive Unix.

Any help is appreciated.

Morten.

2. White Paper / Server Clustering

3. Q: A UNIX COMMUNICATION PROGRAMMING QUESTION. NEED HELP!

4. linux in windows subdirectory...

5. Serial communication over leased line in C (UNIX)?

6. UNIX device drivers

7. Need suggestions for books on serial line communication.

8. Newbie instalation: Memory probs

9. Help with Serial port Communications on DSR/DTR lines

10. How to set up serial port when programming serial communication

11. NEED HELP WITH PROGRAMMING POP3 MAIL PROGRAM TO RETRIEVE MAIL ON UNIX-TO-UNIX

12. How to set up serial port when programming serial communication