Solved

serial communication programm for UNIX

Posted on 1998-06-10
10
238 Views
Last Modified: 2010-04-15
Ok,  I am trying to write a serial program.  At this point I am just trying to get the port, and dial out to another computer.  I am trying to do this on a SCO UNIX box.  Currently, I am successfully getting the port and setting the atts of it.  ( At least I think I am).  As far as I understand it  All I need to do is do a write to the port, and then I can read from it.  I am correct?  Is there anything I need to do before hand?  Thanks guys
0
Comment
Question by:kellyjj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
10 Comments
 

Expert Comment

by:grmbl
ID: 1251177
You need to use the ioperm() function to give yourself permission to write/read at that address. Did you do that? And what is the actual problem? You can use inb/oub or you can open /dev/port
0
 
LVL 32

Expert Comment

by:jhance
ID: 1251178
ioperm() and inb/oub are NOT the way to do this.  You can open the port with open(), read it with read() and write it with write().  If you need to set any of it's attributes use one of the termios functions (see man termios).


0
 
LVL 32

Expert Comment

by:jhance
ID: 1251179
ioperm() and inb/oub are NOT the way to do this.  You can open the port with open(), read it with read() and write it with write().  If you need to set any of it's attributes use one of the termios functions (see man termios).


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:kellyjj
ID: 1251180
I don't have a problem reading from the writing .  What I am having a problem with is reading from the port.  I can write ok.  For example I send to the port (modem)  AT^M  I should see back OK. But I don't.  
0
 

Expert Comment

by:grmbl
ID: 1251181
Then please paste the piece of code which you are using to read. And the piece where you open the port.
0
 
LVL 2

Expert Comment

by:seedy
ID: 1251182
I do not have solutions, just a few hints ;-)

> I am successfully getting the port and setting the atts of it.  ( At least I think I am).
What attributes, and how are you setting this?

Use "stty -a < /dev/your_port" to check the current I/O settings for the port in question.  Post the output here.

Use simple unix level commands to check the modem is working fine.

$ cat < /dev/your_port&;cat > /dev/your_port&

and then type AT commands onthe keyboard to see you get response back from the modem.

0
 

Expert Comment

by:mkdjo
ID: 1251183
Do you read from the same port you write to? Try reading from another computer.
0
 
LVL 1

Expert Comment

by:slinky
ID: 1251184
Also make sure that the device does not have a getty set up on it.
0
 
LVL 2

Accepted Solution

by:
JYoungman earned 100 total points
ID: 1251185
If you have set the port up correctly (with termios(3)) then
you can indeed just read from it and write from it.  

Don't let the <stdio.h> bufferring get in your way though -- use either read(2) and write(2), or use setvbuf(3) to turn off buffering if your're using a FILE* rather than a plain fd.

0
 
LVL 2

Author Comment

by:kellyjj
ID: 1251186
Thanks I thought I might not be setting things up correctly.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question