| Newsgroups |
gmane.comp.emulators.hercules390.general |
| Message-ID |
<[email protected]> |
---In [email protected], <gtaylor@...> wrote :
>> I have tried with "telnet" instead of "tcp" but it still fails to connect
>> to Hercules.
> Can you elaborate?
> Did qemu fail to connect? Did it connect, but the data through the
> connection didn't do what you wanted?
qemu thinks it has connected, so boots
my OS. But Hercules fails to say
"connection received" or whatever.
When I start my application (pdpser)
I receive an x'ff'.
I also know that telnet and tcp do indeed
behave differently, since I now have my
"tnbridge" program working to some
extent.
> I feel like we're at least talking about a telnet client not connecting
> to Hercules's telnet server properly. Or at least as desired.
True, that's the situation and it should
ideally be fixed properly.
> I would be interested in seeing a packet capture of the traffic between
> Qemu and Hercules.
Ok, I'll try to get that.
> I also find the port 3270 to be interesting. At least I'm used to
> people using that port for the TN3270 connections. Which I'm guessing
> Qemu doesn't support.
Right. Normally I do a telnet localhost 3270
and it works fine with my 1052 terminal
(modified to be EBCDIC ANSI) or my
3215 line mode console.
> You did mention a 1052, which I'm taking to be the ASCII terminal. Is
> that the device listening on port 3270?
Yes.
> Can we see the germane portion of the Hercules config file?
0009 1052 noprompt
>> qemu fullscreen is exactly what I'm looking at for when my eyesight
>> fades and I need bigger letters. It gives me a 25*80 screen. The next
>> thing I need is for it to be able to drive MVS, which is what I will do
>> after PDOS/390.
> Please forgive me for asking. But are you using PDOS/390 in Qemu as a
It is PDOS/386 I am running under Qemu.
PDOS/390 runs under Hercules.
> fancy terminal emulator
It's not fancy, it's very primitive (a 32-bit clone of
MSDOS), and I will need to add ANSI support to it.
> so that you can have full screen and better font
> support to more comfortable use MVS running in Hercules?
It is the EBCDIC ANSI terminal I am after, so
that I can run micro-emacs on MVS. It's easier
to use PDOS/3x0 as a test bed. Getting
micro-emacs to run under MVS is pretty
horrible at the moment. Note that I already
have things working using "telnet" that
comes with Cygwin, but just recently I
realized I could use PDOS/386 to drive
PDOS/390 or MVS/380.
> I think that's a laudable goal. I suspect there might be simpler ways
> to achieve that goal. But, I'm happy to help (such as I can) what ever
> you want to do.
Ok, thanks. I have tried your suggestion of
bridging the two components, but there is
a problem somewhere because the
program terminates early without any
explanation. If I comment out the reading
from the client, then I see the complete
bootup of PDOS/390. But obviously I
then can't enter my own commands.
Code is below. I'll move on to debugging
Hercules now to find out why the qemu
telnet client is not being accepted.
BFN. Paul.
/*********************************************************************/
/* */
/* This Program Written by Paul Edwards */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* tnbridge - connect two things requiring telnet */
/* */
/*********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
static int lsock;
static int sockfd; /* socket used to communicate with client */
static int sockh; /* socket used to communicate with host */
struct hostent *hep;
struct sockaddr_in sockain;
struct sockaddr newsocka;
static int newsocklen;
static unsigned char buf[20000];
static int cnt;
static int x;
int main(int argc, char **argv)
{
#if 0
printf("AAA\n");
printf("%c[2J\n", 0x1b);
printf("BBB\n");
printf("CCC\n");
return (0);
#endif
if (argc != 3)
{
printf("usage: tnbridge <host port> <client port>\n");
printf("e.g. tnbridge 3270 32700\n");
return (EXIT_FAILURE);
}
sockh = socket(AF_INET, SOCK_STREAM, 0);
printf("return sockh is %d\n", sockh);
if (sockh < 0) return (EXIT_FAILURE);
hep = gethostbyname("localhost" /* argv[x] */);
if (hep == NULL) return (EXIT_FAILURE);
printf("addr0 is %x\n", hep->h_addr[0]);
memset(&sockain, 0, sizeof sockain);
sockain.sin_family = AF_INET;
memcpy(&sockain.sin_addr.s_addr,
hep->h_addr,
sizeof sockain.sin_addr.s_addr);
sockain.sin_port = htons(atoi(argv[1]));
if (connect(sockh,
(struct sockaddr *)&sockain,
sizeof sockain)
< 0) return (EXIT_FAILURE);
printf("connected\n");
/* cnt = write(sockh, buf, sizeof buf); */
/* expecting IAC DO TERMINAL_TYPE */
cnt = read(sockh, buf, sizeof buf);
printf("got %d bytes\n", cnt);
printf("char 0 is %x\n", buf[0]);
printf("char 1 is %x\n", buf[1]);
printf("char 2 is %x\n", buf[2]);
/* printf("%s\n", buf); */
write(sockh, "\xff\xfb\x18", 3); /* IAC WILL TERMINAL_TYPE */
/* expecting IAC SB TERMINAL_TYPE SEND IAC SE */
cnt = read(sockh, buf, sizeof buf);
printf("got %d bytes\n", cnt);
printf("char 0 is %x\n", buf[0]);
printf("char 1 is %x\n", buf[1]);
printf("char 2 is %x\n", buf[2]);
printf("char 3 is %x\n", buf[3]);
printf("char 4 is %x\n", buf[4]);
printf("char 5 is %x\n", buf[5]);
write(sockh, "\xff\xfa\x18\x00"
"ANSI"
"\xff\xf0", 10);
/* IAC SB TERMINAL_TYPE IS */
/* terminal type */
/* IAC SE */
/* expecting IAC WONT ECHO */
cnt = read(sockh, buf, sizeof buf);
printf("got %d bytes\n", cnt);
printf("char 0 is %x\n", buf[0]);
printf("char 1 is %x\n", buf[1]);
printf("char 2 is %x\n", buf[2]);
write(sockh, "\xff\xfe\x01", 3); /* IAC DONT ECHO */
printf("You can connect client now\n");
lsock = socket(AF_INET, SOCK_STREAM, 0);
printf("return lsock is %d\n", lsock);
if (lsock < 0) return (EXIT_FAILURE);
memset(&sockain, 0, sizeof sockain);
sockain.sin_family = AF_INET;
sockain.sin_addr.s_addr = htonl(INADDR_ANY);
sockain.sin_port = htons(atoi(argv[2]));
if (bind(lsock,
(struct sockaddr *)&sockain,
sizeof sockain)
< 0) return (EXIT_FAILURE);
printf("bound\n");
if (listen(lsock, 64) < 0) return (EXIT_FAILURE);
printf("heard\n");
sockfd = accept(lsock,
&newsocka,
&newsocklen);
printf("newsock is %d\n", sockfd);
printf("IPL now\n");
/* exit when we don't receive output */
while (1)
{
cnt = read(sockfd, buf, sizeof buf);
if (cnt > 0)
{
printf("got %d bytes from client\n", cnt);
write(sockh, buf, cnt);
}
cnt = read(sockh, buf, sizeof buf);
if (cnt > 0)
{
printf("got %d bytes from host\n", cnt);
write(sockfd, buf, cnt);
}
/* usleep(1000); */
}
printf("terminating\n");
close(sockfd);
close(sockh);
return (0);
}