javascript & telnet

This is a discussion on "javascript & telnet" within the JavaScript Forum section. This forum, and the thread "javascript & telnet are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 23rd, 2004, 17:13
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
javascript & telnet

Hi,

I have been searching for a method to start a telnet session, sent data to it and end the telnet session automatically. For now it seems I need an ActiveX control to do such a thing, but there has to be another solution, right? I'm really frustrated!!! I have searched for almost a whole day and I cannot find anything. But then again, maybe I have been searching the wrong places.....

I hope someone can help me to see the light!!!

Hanz

  #2 (permalink)  
Old Apr 23rd, 2004, 17:45
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Are you talking about doing this from the client end or the server end?

Client-side would be ActiveX or Java. Server side you've probably got a few more options. Also, are you sure a telnet session is the best way to accomplish what you're trying to do? I'm not sure what it is so I can't guess, but SOAP and web services are just a couple ways of moving data around and can do some really cool things.
  #3 (permalink)  
Old Apr 23rd, 2004, 20:11
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe if you could tell us what the telnet session will be used for we could possibly offer alternatives?
  #4 (permalink)  
Old Apr 24th, 2004, 21:31
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you for you reactions!!! I have to use telnet or ftp in order to send some code to a printer. This code is already embedded in the pages (cliënt side) and it would be really nice if I get everything to work from the clïent in stead of sending the code back to the server.

I have to find a solution which generates the least possible network traffic as I already have to get data 'from all over the world' . I have found a cliënt side ActiveX control, but in order to use that control, it have to be installed on each cliënt that want to make use of it and it is not a free activeX control. (maybe you know of a free activeX control?).

So in conclusion: the user makes a selection, based on that selection several databases are contacted and data is transfered to hidden inputs at the cliënt side. The the user selects the printer it wants to use (from a other database). The right (hidden) code has to be sent through a telnet session to the selected printer which is going to print eventually. So the cliënt has to start a telnet session, sent data to it and close the connection.

I hope it is somewhat clearer now....
  #5 (permalink)  
Old Apr 25th, 2004, 04:12
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
What about...

So in conclusion: the user makes a selection and selects the printer it wants to use (from a other database). , based on that selection several databases are contacted and data is <s>transfered to hidden inputs at the cliënt side</s> generated on the server. <s>The the user selects the printer it wants to use (from a other database). The right (hidden) code has to be sent through a telnet session to the selected printer which is going to print eventually. So the cliënt has to start a telnet session, sent data to it and close the connection.</s> The data is then sent to a internet (or network) shared password-protected printer.

This would negate the need for an ActiveX control, no need for telnet or ftp, and it would reduce the number of calls between the client and server, lowering the network traffic.
  #6 (permalink)  
Old Apr 25th, 2004, 14:21
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Hi again,

Problem: it's not just a normal printer. I don't know if you are familiair with Zebra high performance labelprinters, but to be able to print to this printer without using a printerdriver, I have to use telnet to get this printer to print.

The selection of which data to print and the selection of which printer to use are different processes and different databases. So I really need a method to start a telnet session from the client side....
  #7 (permalink)  
Old Apr 26th, 2004, 08:07
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Does the manufacturer of this printer not offer any solutions to this problem?
  #8 (permalink)  
Old Apr 26th, 2004, 20:25
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
eehm no. I did contact the manufacturer already and they think I did too much already..... So there seems to be no one who is experienced with making a telnet session work from a webpage client side also....but if there is someone who has experience with telnet session from webpages (in the background, no user input in session itself...) server side and is able to explain it to me how I can do such a thing.... I would be very thankfull!!!
  #9 (permalink)  
Old Apr 27th, 2004, 08:38
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
http://www.google.co.uk/search?q=telnet+%2B+asp

http://www.dart.com/telnet.asp

http://www.telnet-activex-asp-vb-component-control.com/
WebTelnet is a collection of standard Internet protocols that allow to login to a remote server and execute commands from within an HTML or ASP page, i.e. over HTTP (port 80). The results of the execution of these commands may be displayed within a browser. A custom program or script can then act on these results.
  #10 (permalink)  
Old Apr 27th, 2004, 10:47
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you for the links. It is a pitty that all suggestions are not free of charge. I heard also something about using winsock as a different approach. Can someone tell me if this problem I have can be solved by using winsock? But for now I'm going to use the trial version and use them on the server. I will let you know if it is working....
  #11 (permalink)  
Old Apr 27th, 2004, 11:48
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Keep googling im sure you'll find something free...

btw, does your server support ASP or PHP?
  #12 (permalink)  
Old Apr 27th, 2004, 14:04
New Member
Join Date: Apr 2004
Location: Netherlands
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Hi!!

The server supports asp, PHP support can be installed. I'm reading documentation now of using webservice behaviour and SOAP (looks a lot like the first answer I got....).

Hans
  #13 (permalink)  
Old May 13th, 2004, 16:58
New Member
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
You can send information into a telnet session on the client-side by using an HTML form and Javascript. For an example of usage see the source for my page:
http://auxcon.tripod.com/mailbaux/index.htm (please ignore the ads)
-This page just gives an example of sending an email by using open-relay SMTP servers through Telnet. An option is even given to use a Wingate or multiple Wingates in order to increase anonymity. It no longer works because the software at the specific servers used have probably been upgraded or settings refined, but the principle still works, and it is a good look at what I'll call Telnet pseudo-sessions in HTML and Javascript.
  #14 (permalink)  
Old May 14th, 2004, 08:25
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Cant see the source, could you post it here please?
  #15 (permalink)  
Old May 18th, 2004, 07:09
New Member
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Below is the code for the SMTP Telnet session sent through HTTP and HTML. Note: I'm not entirely positive that this works on IE6, but I know it does on IE5.5 and below. Also note that the form will not work with the servers currently listed, but it should work with working open-relay SMTP servers and wingates.

There are 2 pages here, copy them individually to notepad, name them ????.htm (or whatever), and open them in IE to see them.

Here is a version of the page that will demonstrate exactly what is being sent:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE>SimpleSend</TITLE>

<SCRIPT>
function setsrvr(){
if(smtp.srvr.value!=""){
smtp.action=smtp.srvr.value;
}
alert("This form will submit to:\n"+smtp.action);
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="buttonface">
<FORM NAME="smtp" METHOD="post" ENCTYPE="text/plain" ACTION="http://61.133.119.130:23">Server:
<INPUT NAME="srvr" TYPE="text" SIZE="15" VALUE="" TITLE="Ex.: mail.server.com"><INPUT TYPE="button" ONCLICK="setsrvr();" VALUE="Set Server">

<TEXTAREA NAME="msg" ROWS=20 COLS=75>

HELO
MAIL FROM:
RCPT TO:
DATA
From:
To:
Subject:
Reply-To:
DATA

.
QUIT
</TEXTAREA><INPUT TYPE="submit" VALUE="Send"></FORM>

************************************************** ************
************************************************** ************
************************************************** ************
************************************************** ************

Here is another, more user-friendly example:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--
function viewIt(){
if(frmServer.wgCheck.checked){
smtp.action = "http://61.133.119.130:23"; // ! This is the initial WinGate
var anon = "High Anonymity: ON\n";
if(frmServer.txtServer.value != ""){
var wgLink = frmServer.txtServer.value + " 25\n";
}
else if(frmServer.cboServer.value==""){
var wgLink = "harrier.prod.itd.earthlink.net 25\n";
}
else{
var wgLink = frmServer.cboServer.value;
wgLink = wgLink.substring(7,wgLink.length);
wgLink = wgLink.substring(0,wgLink.length-3);
wgLink = wgLink+" 25\n";
}
}
else{
var anon = "High Anonymity: OFF\n";
if(frmServer.txtServer.value != ""){
smtp.action = "http://" + frmServer.txtServer.value + ":25";
}
else if(frmServer.cboServer.value==""){
smtp.action = "http://harrier.prod.itd.earthlink.net:25";
}
else{
smtp.action = frmServer.cboServer.value;
}
}
var relay1 = "61.133.119.130 23\n"; // ! This is a WinGate that the connection will be relayed through
var relay2 = "202.160.13.194 23\n"; // ! This is a WinGate that the connection will be relayed through
var relay3 = "164.100.254.106 23\n"; // ! This is a WinGate that the connection will be relayed through
var wgShow = "The following Wingates will be used to relay the connection:\n";
var wgNote1 = " "+relay1;
var wgNote2 = " "+relay2;
var wgNote3 = " "+relay3;
var note = "This email will be relayed through: ";
var from = email.from.value;
var atsign = from.substring(0,from.lastIndexOf('@')+1);
var helo = from.substring(atsign.length,from.length+1);
var to = email.to.value;
var nameFrom = email.nameFrom.value;
var nameTo = email.nameTo.value;
var replyto = email.replyTo.value;
var subject = email.subject.value;
var m1 = "HELO " + helo + "\n";
var m2 = "MAIL FROM:" + from + "\n";
var m3 = "RCPT TO:" + to + "\n";
var m4 = "DATA" + "\n";
if(nameFrom==""){
var m5 = "From: " + from + "\n";
}
else{
var m5 = "From: " + nameFrom + " <" + from + ">\n";
};
if(nameTo==""){
var m6 = "To: " + to + "\n";
}
else{
var m6 = "To: " + nameTo + " <" + to + ">\n";
};
var m7 = "Subject: " + subject + "\n";
var m8 = "Reply-To: " + replyto + "\n";
var message = email.message.value;
var m9 = "\n.\n";
var m10 = "QUIT" + "\n";
if(frmServer.wgCheck.checked){
if(email.replyTo.value==""){
smtp.finale.value =

(anon+wgShow+wgNote1+wgNote2+wgNote3+note+wgLink+" \n\n"+m1+m2+m3+m4+m5+m6+m7+"\n"+message+m9+m10);
}
else{
smtp.finale.value =

(anon+wgShow+wgNote1+wgNote2+wgNote3+note+wgLink+" \n\n"+m1+m2+m3+m4+m5+m6+m7+m8+"\n"+message+m9+m10) ;
}
}
else{
if(email.replyTo.value==""){
smtp.finale.value = (anon+note+smtp.action+"\n\n"+m1+m2+m3+m4+m5+m6+m7 +"\n"+message+m9+m10);
}
else{
smtp.finale.value = (anon+note+smtp.action+"\n\n"+m1+m2+m3+m4+m5+m6+m7 +m8+"\n"+message+m9+m10);
}
}
};
function sendIt(){
if(frmServer.wgCheck.checked){
smtp.action = "http://61.133.119.130:23"; // ! This is the initial WinGate
if(frmServer.txtServer.value != ""){
var wgLink = frmServer.txtServer.value + " 25\n";
}
else if(frmServer.cboServer.value==""){
var wgLink = "harrier.prod.itd.earthlink.net 25\n";
}
else{
var wgLink = frmServer.cboServer.value;
wgLink = wgLink.substring(7,wgLink.length);
wgLink = wgLink.substring(0,wgLink.length-3);
wgLink = wgLink+" 25\n";
}
}
else{
if(frmServer.txtServer.value != ""){
smtp.action = frmServer.txtServer.value + " 25";
}
else if(frmServer.cboServer.value==""){
smtp.action = "http://harrier.prod.itd.earthlink.net:25";
}
else{
smtp.action = frmServer.cboServer.value;
}
}
var relay1 = "61.133.119.130 23\n"; // ! This is a WinGate that the connection will be relayed through
var relay2 = "202.160.13.194 23\n"; // ! This is a WinGate that the connection will be relayed through
var relay3 = "164.100.254.106 23\n"; // ! This is a WinGate that the connection will be relayed through
var from = email.from.value;
var atsign = from.substring(0,from.lastIndexOf('@')+1);
var helo = from.substring(atsign.length,from.length+1);
var to = email.to.value;
var nameFrom = email.nameFrom.value;
var nameTo = email.nameTo.value;
var replyto = email.replyTo.value;
var subject = email.subject.value;
var m1 = "HELO " + helo + "\n";
var m2 = "MAIL FROM:" + from + "\n";
var m3 = "RCPT TO:" + to + "\n";
var m4 = "DATA" + "\n";
if(nameFrom==""){
var m5 = "From: " + from + "\n";
}
else{
var m5 = "From: " + nameFrom + " <" + from + ">\n";
}
if(nameTo==""){
var m6 = "To: " + to + "\n";
}
else{
var m6 = "To: " + nameTo + " <" + to + ">\n";
}
var m7 = "Subject: " + subject + "\n";
var m8 = "Reply-To: " + replyto + "\n";
var message = email.message.value;
var m9 = "\n.\n";
var m10 = "QUIT" + "\n";
if(frmServer.wgCheck.checked){
if(email.replyTo.value==""){
smtp.finale.value = ("\n"+relay2+relay3+wgLink+m1+m2+m3+m4+m5+m6+m7+"\ n"+message+m9+m10);
}
else{
smtp.finale.value = ("\n"+relay2+relay3+wgLink+m1+m2+m3+m4+m5+m6+m7+m8 +"\n"+message+m9+m10);
}
}
else{
if(email.replyTo.value==""){
smtp.finale.value = ("\n"+m1+m2+m3+m4+m5+m6+m7+message+m9+m10);
}
else{
smtp.finale.value = ("\n"+m1+m2+m3+m4+m5+m6+m7+m8+message+m9+m10);
}
}
PleaseWait.style.visibility = "visible";
smtp.submit();
};
function switchServer(){
if(frmServer.cboServer.value==""){
alert("Please choose a relay server.");
}
else{
var server = frmServer.cboServer.value;
smtp.action = server;
}
}
// -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="buttonface" ONLOAD="email.from.focus();" ONUNLOAD="PleaseWait.style.visibility='visible';">
<FORM NAME="frmServer" ACTION="">
<A STYLE="POSITION: ABSOLUTE; TOP: 15; CURSOR: default;">Server:</A><INPUT NAME="txtServer" TYPE="text" SIZE="15" VALUE=""

TABINDEX=1 STYLE="POSITION: ABSOLUTE; TOP: 15; LEFT: 80" TITLE="Ex.: mail.server.com">


<DIV STYLE="POSITION: ABSOLUTE; TOP: 15; LEFT: 200;">
OR
<SELECT SIZE="1" NAME="cboServer" ONCHANGE="switchServer()" TABINDEX=3>
<OPTION VALUE="" SELECTED>Please choose a relay server...</OPTION>
<OPTION VALUE="http://harrier.prod.itd.earthlink.net:25">Harrier (DEFAULT)</OPTION>
<OPTION VALUE="http://pintail.mail.pas.earthlink.net:25">Pintail</OPTION>
<OPTION VALUE="http://flamingo.mail.pas.earthlink.net:25">Flamingo</OPTION>
</SELECT>
?
<INPUT TYPE="checkbox" NAME="wgCheck"><FONT SIZE=1>High Anonymity</FONT>
</DIV>
</FORM>
<FORM NAME="email">
<A STYLE="POSITION: ABSOLUTE; TOP: 50;">From:</A><INPUT NAME="from" TYPE="text" SIZE="15" VALUE="" TABINDEX=5

STYLE="POSITION: ABSOLUTE; TOP: 50; LEFT: 80">
<A STYLE="POSITION: ABSOLUTE; TOP: 50; LEFT: 200;">Name:<INPUT NAME="nameFrom" TYPE="text"

SIZE="15" VALUE="" TABINDEX=5></A>


<A STYLE="POSITION: ABSOLUTE; TOP: 85;">To:</A><INPUT NAME="to" TYPE="text" SIZE="15" VALUE="" TABINDEX=6

STYLE="POSITION: ABSOLUTE; TOP: 85; LEFT: 80">
<A STYLE="POSITION: ABSOLUTE; TOP: 85; LEFT: 200;">Name:<INPUT NAME="nameTo" TYPE="text"

SIZE="15" VALUE="" TABINDEX=6></A>


<A STYLE="POSITION: ABSOLUTE; TOP: 120;">Reply-To:</A><INPUT NAME="replyTo" TYPE="text" SIZE="15" VALUE="" TABINDEX=7

STYLE="POSITION: ABSOLUTE; TOP: 120; LEFT: 80">


<A STYLE="POSITION: ABSOLUTE; TOP: 155;">Subject:</A><INPUT NAME="subject" TYPE="text" SIZE="15" VALUE="" TABINDEX=8

STYLE="POSITION: ABSOLUTE; TOP: 155; LEFT: 80">


<A STYLE="POSITION: ABSOLUTE; TOP: 190;">Message:</A>
<TEXTAREA NAME="message" ROWS=20 COLS=75

TABINDEX=9></TEXTAREA>


<INPUT NAME="cmdView" TYPE="button" VALUE="View" ONCLICK="viewIt();" TABINDEX=10>
<INPUT NAME="cmdSend" TYPE="button" VALUE="Send" ONCLICK="sendIt();" TABINDEX=11>
<A ID="PleaseWait" STYLE="VISIBILITY: hidden;"><FONT SIZE=2 COLOR="#FF0000">Please wait while your

message is being sent...</FONT></DIV>


</FORM>
<FORM NAME="smtp" METHOD="post" ENCTYPE="text/plain" ACTION="http://61.133.119.130:23">
<TEXTAREA NAME="finale" ROWS=20 COLS=75 TABINDEX=12 STYLE="VISIBILITY: VISIBLE;"></TEXTAREA>
</FORM>
</BODY>
</HTML>
Closed Thread

Tags
javascript, telnet

Thread Tools

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Javascript in php Martin McPherson PHP Forum 3 Oct 27th, 2006 11:47
How is this done? PHP, Javascript or both? ktsirig PHP Forum 4 May 1st, 2006 12:23
Execute telnet client or Hyperterminal on local computer tnarvaez Introduce Yourself 1 Feb 25th, 2006 02:14
Execute telnet client or Hyperterminal on local computer tnarvaez JavaScript Forum 1 Feb 25th, 2006 02:12
what does \\ mean in javascript jenjen1018 JavaScript Forum 5 Jan 6th, 2004 17:05


All times are GMT. The time now is 19:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43