- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- Sending message to a remote telnet device
-
-
Categories
- Topics
- Hybrid IT with Cloud
- Mobile & IoT
- IT for Data & Analytics
- Transformation
- Strategy and Technology
- Products
- Cloud
- Integrated Systems
- Networking
- Servers and Operating Systems
- Services
- Storage
- Company
- Events
- Partner Solutions and Certifications
- Welcome
- Welcome
- Announcements
- Tips and Tricks
- Feedback
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- Converged Data Center Infrastructure
- Digital Transformation
- Grounded in the Cloud
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- Networking
- OEM Solutions
- Servers: The Right Compute
- Telecom IQ
- Transforming IT
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Categories
-
Forums
-
Blogs
-
InformationEnglish
Sending message to a remote telnet device
SOLVED- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2010 02:24 AM
05-08-2010 02:24 AM
This is my first post and my first entry into VMS. I need some help regarding a problem.
I have a program running on a remote machine that reads from a telnet device. I need to connect and send a message every second to this device remotely..
Could you please share some ideas on how I go about doing this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2010 02:32 AM
05-08-2010 02:32 AM
Re: Sending message to a remote telnet device
Re: Sending message to a remote telnet device
$ telnet
$ SET TERMINAL TNA1997:/perm/nobroadcast/noecho/type_adhead/nowrap/tab/form/SPEED=2400/PARITY=EVEN/PERM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2010 03:37 AM
05-08-2010 03:37 AM
Re: Sending message to a remote telnet device
Re: Sending message to a remote telnet device
Given the dearth of information posted in the question, I'm unfortunately inferring much and may or may not be correctly inferring.
When posting, it's useful to provide a little more detail on the problem and some product versions. For this case, that would be VMS versions, the IP static, maybe the remote client, and how you envision using this network link.
With telnet involving OpenVMS systems, you'll have telnet TN-class devices on both ends of the connection. To establish a telnet device on OpenVMS with TCP/IP Services product, see the CREATE_SESSION command or the DCL telnet command's qualifier /CREATE_SESSION.
From the OpenVMS FAQ:
--
15.2.5 How can I set up reverse telnet (like reverse LAT)?
Though it may seem obvious, Telnet and LAT are quite differentâ with differing capabilities and design goals.
Please see the documentation around the TCP/IP Services for OpenVMS TELNET command CREATE_SESSION. This command is the equivilent of the operations performed in LTLOAD.COM or LAT$SYSTARTUP.COM. There is no TELNET equivilent to the sys$qio[w] control interface for LTDRIVER (as documented in the I/O Userâ s Reference Manual) available, though standard sys$qio[w] calls referencing the created TN device would likely operate as expected.
--
Once you have a telnet TN device, it's a terminal device. Little different than an interactive terminal you've logged into OpenVMS on, too. You can open and read and write it using $qio, language-level file I/O calls, or the DCL command OPEN followed by READ and WRITE and such and (eventually) CLOSE the device.
Now in general, telnet does work for and is designed for use with terminals and printers, and for data usually associated with those devices.
It's not a particularly good choice as a generic interprocess communications protocol, and there can be issues when working with or transferring binary data, for instance.
In recent times, it's less common to see this sort of direct telnet-based programming done; folks are tending to use middleware to deal with this stuff, or are establishing socket connections directly; whether via a known port or via portmapper or via a DNS SRV record or other such.
In recent times, I've only seen or employed telnet and telnet devices with old ASCII-based designs and with exceedingly limited-neworking environments. It's rare. (I have and do use telnet to connect to remote ports for debugging purposes.)
The following socket example is from a Unix box but should work similarly to OpenVMS. This connects to a US NIST server ( time-b.nist.gov) on port 13 and fetches the current time from that server via the Daytime Protocol (RFC-867) mechanisms.
#include
#include
#include
#include
#include
#include
#include
void error(char *msg)
{
perror(msg);
exit(0);
}
int main(int argc, char *argv[])
{
int sockfd, portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
char buffer[256];
if (argc < 3) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
}
portno = atoi(argv[2]);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
server = gethostbyname(argv[1]);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno);
if (connect(sockfd,(void *)&serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
n = read(sockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
printf("%s\n",buffer);
return 0;
}
$ cc x.c
$ ./a.out time-b.nist.gov 13
55323 10-05-07 04:31:44 50 0 0 498.4 UTC(NIST) *
$
This C code is a variation of the client code available here:
http://www.linuxhowtos.org/C_C++/socket.htm
There is example server code there.
And for the furtherance of your own career in the software industry, please supplant what you were (mis?)taught in school with the following career-advancement advice:
http://www.catb.org/~esr/faqs/smart-questions.html
I'm not kidding here, either. Knowing how to ask a question will advance your career. Surprisingly, most schools don't teach that, either.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2010 04:14 AM
05-08-2010 04:14 AM
Solutionhttp://vouters.dyndns.org/tima/OpenVMS-TCPIP-Creating-and-Deleting-a-Telnet-device.html
http://vouters.dyndns.org/tima/All-OS-Non-interactive-telnet-tool.html
Or most any other C client-server socket program.
Or 0MQ or other middleware.
http://www.zeromq.org/
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2010 05:01 AM
05-08-2010 05:01 AM
Re: Sending message to a remote telnet device
Re: Sending message to a remote telnet device
Thanks for the help and advice
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP