Networking Forums

Networking Forums > Computer Networking > Linux Networking > programming serial port

Reply
Thread Tools Display Modes

programming serial port

 
 
Carmin
Guest
Posts: n/a

 
      11-18-2003, 04:08 PM
Hello,



I have to establishe communication between 2 PC with modems. The remote PC
works under windows 98 and sends data buffer or file to my local PC wich is
under linux redhat. I am beginner with linux and my question is to know if
it is possible to manage the reception of data only writing a script. Or I
have to write a C program using the termios structure to configure serial
port and open, read, write functions. What is the best way for my work?



I thank you for your answers and excuse-me for my bad english.


 
Reply With Quote
 
 
 
 
Frank da Cruz
Guest
Posts: n/a

 
      11-18-2003, 05:01 PM
In article <bpdjo9$2sm$(E-Mail Removed)>, Carmin wrote:
: I have to establishe communication between 2 PC with modems. The remote PC
: works under windows 98 and sends data buffer or file to my local PC wich is
: under linux redhat. I am beginner with linux and my question is to know if
: it is possible to manage the reception of data only writing a script. Or I
: have to write a C program using the termios structure to configure serial
: port and open, read, write functions. What is the best way for my work?
:
Yes, you can do it with a Kermit script:

http://www.columbia.edu/kermit/ckermit.html C-Kermit for Linux
http://www.columbia.edu/kermit/k95.html Kermit 95 for Windows
http://www.columbia.edu/kermit/ckscripts.html Scripting tutorial


- Frank
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      11-19-2003, 01:07 AM
On Tue, 18 Nov 2003 18:08:16 +0100, Carmin <(E-Mail Removed)> wrote:
> Hello,
>
> I have to establishe communication between 2 PC with modems. The remote PC
> works under windows 98 and sends data buffer or file to my local PC wich is
> under linux redhat. I am beginner with linux and my question is to know if
> it is possible to manage the reception of data only writing a script. Or I
> have to write a C program using the termios structure to configure serial
> port and open, read, write functions. What is the best way for my work?


If you know how to Perl script, you might look for Device::SerialPort
module on a CPAN mirror. It is a Unix (Linux) version of Win32::Serial
port.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a

 
      11-19-2003, 03:27 AM
In article <bpdjo9$2sm$(E-Mail Removed)>, Carmin wrote:

> I have to establishe communication between 2 PC with modems. The remote PC
> works under windows 98 and sends data buffer or file to my local PC wich is
> under linux redhat. I am beginner with linux and my question is to know if
> it is possible to manage the reception of data only writing a script.


Sure. Use Kermit like Frank suggested, or use Bash and sz/rz
commands to transfer files using xmodem/ymodem/zmodem
protocols. If you really want to go old-school, you could set
up uucp -- if you've got a whole dial-up network, uucp still
rocks.

> Or I
> have to write a C program using the termios structure to configure serial
> port and open, read, write functions. What is the best way for my work?


If you decide to write a program, for god's sake don't use C --
you're not write a kernel module. Use a high-level language
like Python or Perl (gack!)

--
Grant Edwards grante Yow! I've read SEVEN
at MILLION books!!
visi.com
 
Reply With Quote
 
Alan Connor
Guest
Posts: n/a

 
      11-19-2003, 04:02 AM
On 19 Nov 2003 04:27:21 GMT, Grant Edwards <(E-Mail Removed)> wrote:
>
>
> In article <bpdjo9$2sm$(E-Mail Removed)>, Carmin wrote:
>
>> I have to establishe communication between 2 PC with modems. The remote PC
>> works under windows 98 and sends data buffer or file to my local PC wich is
>> under linux redhat. I am beginner with linux and my question is to know if
>> it is possible to manage the reception of data only writing a script.

>
> Sure. Use Kermit like Frank suggested, or use Bash and sz/rz
> commands to transfer files using xmodem/ymodem/zmodem
> protocols. If you really want to go old-school, you could set
> up uucp -- if you've got a whole dial-up network, uucp still
> rocks.


minicom can do zmodem stuff.
and the tool for zmodem on posix computers is lrzsz.

>
>> Or I
>> have to write a C program using the termios structure to configure serial
>> port and open, read, write functions. What is the best way for my work?

>
> If you decide to write a program, for god's sake don't use C --
> you're not write a kernel module. Use a high-level language
> like Python or Perl (gack!)


Beg to differ. C is much more versatile and efficient. Why would someone
want to be limited by P&P? They only SEEM easier. In the long run they
are harder.

AC
 
Reply With Quote
 
Floyd Davidson
Guest
Posts: n/a

 
      11-19-2003, 06:19 AM
Alan Connor <(E-Mail Removed)> wrote:
>On 19 Nov 2003 04:27:21 GMT, Grant Edwards <(E-Mail Removed)> wrote:
>>
>> If you decide to write a program, for god's sake don't use C --
>> you're not write a kernel module. Use a high-level language
>> like Python or Perl (gack!)


As always, Grant provides some excellent advice based on a very
good understanding of the context.

>Beg to differ. C is much more versatile and efficient. Why would someone
>want to be limited by P&P? They only SEEM easier. In the long run they
>are harder.


As always, Alan Connor hasn't got a clue. But, I thought it
would be just perfect to quote from an article that Alan posted
to comp.lang.c a few hours back, because it does put this in a
proper perspective. (Not to mention it's good for a laugh, as
our resident expert gives us a great demonstration of how
"versatile and efficient" C programming is!)

Newsgroups: comp.lang.c
From: Alan Connor <(E-Mail Removed)>
Subject: EOF (novice)
Message-ID: <Fizub.5196$(E-Mail Removed) et>
Date: Wed, 19 Nov 2003 01:02:29 GMT

From K&R:

#include <stdio.h>

main()

/* copy input to output */

{
int c;

c = getchar();
while (c != EOF) {

putchar(c);
c = getchar();

}

}


If I am reading the text correctly, this program should
terminate when I enter -1 (EOF as defined on my system,
Linux).

But it doesn't. Just keeps right on trucking.

What gives?

AC

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Alan Connor
Guest
Posts: n/a

 
      11-19-2003, 08:02 AM
On Tue, 18 Nov 2003 22:19:28 -0900, Floyd Davidson <(E-Mail Removed)> wrote:

Well Floyd, you can libel me until the cows come home. Knock yourself
out.

But I am NOT going to exchange those kinds of pictures with you, and if
you send me any more, they are going to the police.

AC

 
Reply With Quote
 
Floyd Davidson
Guest
Posts: n/a

 
      11-19-2003, 08:45 AM
Alan Connor <(E-Mail Removed)> wrote:
>On Tue, 18 Nov 2003 22:19:28 -0900, Floyd Davidson <(E-Mail Removed)> wrote:
>
>Well Floyd, you can libel me until the cows come home. Knock yourself
>out.
>
>But I am NOT going to exchange those kinds of pictures with you, and if
>you send me any more, they are going to the police.
>
>AC


And now you're over there in c.l.c discussing an *excellent*
program example, from K&R, saying

"You are missing my point: The program as written in K&R
*doesn't work*. Or it seems not to.

That part of the book is POORLY WRITTEN. Lame."

And here you are in this group giving out advice on which
programming languages are best for one particular use. Tsch
tsch, as if you had half a clue.

And your only response to me is to claim that your email that I
bounced back to you incriminates someone other than you...

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Leon.
Guest
Posts: n/a

 
      11-19-2003, 12:37 PM

"Carmin" <(E-Mail Removed)> wrote in message
news:bpdjo9$2sm$(E-Mail Removed)...
> Hello,
>
>
> I have to establishe communication between 2 PC with modems. The remote PC
> works under windows 98 and sends data buffer or file to my local PC wich

is
> under linux redhat. I am beginner with linux and my question is to know if
> it is possible to manage the reception of data only writing a script.



Sounds like you are going to have to build a complicated 'state machine'.

One end has to verify which state the other is in and decide what state to
move to next, and verify it got there.



> Or I
> have to write a C program using the termios structure to configure serial
> port


You can use "stty" to do all this from a script.

Also there is the program "expect" that has the ability to detect various
strings and has a timeout.
So you can write the equivalent of a "send and expect " script.. and recover
from faults.
This saves work under C.





> and open, read, write functions. What is the best way for my work?


That does depend how much programming you need to do , and what libraries
you need to use.

It can be painful to do things in the shell, because of its inability to
handle characters. and lack of simple functions -its got all the standard
utils to use, but they arent low level things, they are high level.

Perl can handle characters better, and has many low level functions ready to
use.
As its only handling a serial line, perl will run fast enough for the job.






>
>
>
> I thank you for your answers and excuse-me for my bad english.
>
>



 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a

 
      11-19-2003, 02:21 PM
In article <BkGub.6763$(E-Mail Removed). net>, Alan Connor wrote:

> But I am NOT going to exchange those kinds of pictures with you, and if you
> send me any more, they are going to the police.


Well, if there was any doubt about whether Mr. Conner's were worth the bits
they were printed on, that certainly clinched it.

--
Grant Edwards grante Yow! Where's th' DAFFY
at DUCK EXHIBIT??
visi.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
no serial port and no parrallel port how do i console to a router sloan949@gmail.com Linux Networking 4 02-13-2007 07:02 PM
Map serial port through TS Tippy Windows Networking 0 11-23-2005 12:06 AM
Parallel port programming Md.Zaheeruddin Khan Linux Networking 0 10-07-2004 01:35 PM
Serial Port Multiplexing (2 apps to 1 port) Onslo Linux Networking 0 10-06-2004 08:53 AM
HELP -- RS-422 serial port programming yields 0x0F char in response?? Joshua Colvin Linux Networking 4 08-01-2003 10:40 AM



1 2 3 4 5 6 7 8 9 10 11