public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: linux-msdos@vger.kernel.org
Cc: Boris Reisig <boris@boris.ca>
Subject: Re: Three major questions.
Date: Sun, 07 Sep 2003 05:58:11 +0400	[thread overview]
Message-ID: <3F5A90B3.40205@aknet.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

Hello.

Boris Reisig wrote:
> 1) To get rid splash screen "Now type ENTER to start DOSEMU" and 
> automatically start dosemu without hitting a key.
"dosemu -quiet" or don't use the dosemu
startup script at all.

> 3) To be able to turn a comport into a telnet port. This would be 
> perfect for BBS software if I could turn the com ports into telnet
> ports.
You probably mean a TCP port here.

> For example. If I connect to my box on port (for example) 5000,
> Dosemu would redirect that as com1, port 5001 would be com2, etc.
> Any chance of this?
This might be very easy as dosemu (since
very recently) can use a pseudo-terminals as
a serial ports.
I've just tried one possibility that came to
my mind first
(example of redirecting COM2 to TCP port 5000
as I see it, follows):

1. Wrote a small program "datacopy" (attached).
[Duh, something like that might be somewhere
among the generic Unix utilities, so I am sure
I've reinvented the wheel by writing it. Can
anyone point me the analog of such a prog?]

2. Configured dosemu to use a pseudo-terminal
as a serial port:
$_com2="/dev/ttyp1"

3. Started the TCP port listener that way:
faucet 5000 --in --out datacopy /dev/ptyp1
(note the difference between "ttyp1" in
step 2 and "ptyp1" here)

4. Opened a connection to that port with a
telnet:
telnet localhost 5000

5. Started dosemu.

6. Started the terminal program on COM2 and got
the communication between the DOS terminal prog
and the telnet session to ensure that the port is
redirected successfully.

"faucet" is from a "netpipes" package, but you
can also set up the [x]inetd for that work (but
using faucet is simpler).

I have never used that for anything real so I don't
know how good it suits the real life needs.
If that works for someone here, or if something is
still missing, or if there is a better solution,
please let me know. I think the current documentation
doesn't have a clear solution for that, so it must
be worked out and documented.

[-- Attachment #2: datacopy.c --]
[-- Type: text/plain, Size: 729 bytes --]

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>

int main(int argc, char *argv[])
{
   char buf[1600];
   int f,l;
   fd_set fds;
 
   if(argc < 2) {
      printf("Usage: datacopy file_name\n");
      return 1;
   }

   f = open(argv[1], O_RDWR);

   while(1){
	FD_ZERO(&fds);
        FD_SET(STDIN_FILENO, &fds);
        FD_SET(f, &fds);

	select(f + 1, &fds, NULL, NULL, NULL);

	if( FD_ISSET(f, &fds) ) {
	   l = read(f,buf,sizeof(buf));
	   if (l <= 0)
	      break;
           write(STDOUT_FILENO,buf,l);
	}
	if( FD_ISSET(STDIN_FILENO, &fds) ) {
	   l = read(STDIN_FILENO,buf,sizeof(buf));
	   if (l <= 0)
	      break;
           write(f,buf,l);
	}
   }
   return 0;
}

             reply	other threads:[~2003-09-07  1:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-07  1:58 Stas Sergeev [this message]
2003-09-07  2:57 ` Three major questions Matthew Clarke
2003-09-07 13:16   ` Stas Sergeev
  -- strict thread matches above, loose matches on Subject: below --
2003-09-11 13:58 Stas Sergeev
2003-09-13  7:28 ` Ryan Underwood
2003-09-10 18:04 Stas Sergeev
2003-09-11  1:05 ` Ryan Underwood
2003-09-06 23:38 administrator
2003-09-08 15:58 ` Ryan Underwood
2003-09-06 21:04 administrator
2003-09-06 21:58 ` Ryan Underwood
2003-09-06 21:58 ` Bart Oldeman
2003-09-06 22:20   ` Cheryl Homiak
2003-09-06 17:18 Boris Reisig
2003-09-06 21:00 ` Ralph Alvy
2003-09-09 17:56 ` Justin Zygmont
2003-09-10 17:09   ` Ryan Underwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F5A90B3.40205@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=boris@boris.ca \
    --cc=linux-msdos@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox