?
Solved

how to send data on a port n return on # prompt

Posted on 2003-12-10
7
Medium Priority
?
346 Views
Last Modified: 2010-04-21
Hi all,
 
I want to send some data or a packet to a tcp port on a socket.
I tried
# telnet <ipaddr> <port no> < test
where test is a file contains a packet.
 
It gives me acknowledgment, but it doesnt come out from the connection. And do not accept escape char eg. ^] or ^D.
I have to kill the process to terminate.
 
How to return on # prompt without killing the process?
Bcos i want to schedule the same process.
 
Please suggest.
 
Thanks,
rishi
0
Comment
Question by:rishi_dongre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 100 total points
ID: 9911701
what about notup and running in background?
nohup telnet <ipaddr> <port no> < test &

0
 

Author Comment

by:rishi_dongre
ID: 9911917
hi liddler,
Your cmd gives me # promt but it dosent close the connection.
Means "telnet" session running continueously.
I want the telent connection also be closed.(The msg like "Connection closed by foreign host")
I m killing the session manually and it kills the connection established with socket.

regds,
0
 
LVL 11

Expert Comment

by:griessh
ID: 9911970
rishi

Could you let us know what's in your <test> file?

=====
Werner
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:liddler
ID: 9912005
you can kill the pid of the telnet session,
i.e.
ps -ef | grep telnet
to get the pid
then kill (or kill -9) the pid
IF it was the last command you ran from the command line
kill -9 %1
0
 

Author Comment

by:rishi_dongre
ID: 9912050
Griessh,
Its a data packet which i send to the server's port and the application read it and acknowledge accordingly.
eg. test file-- 123ADFD3ERE12123432FDSF3434
# telent 123.23.23.12 1234 < test
Connecting to ..
Escape char '^]'
345FKD9094 ( this is the acknowledgement)

And if i do following, i m succeeding.
# telnet 123.23.23.12 1234
Connecting to...
Esccape char...
123ADFD3ERE12123432FDSF3434 ( here i m pasting the string)
345FKD9094Connection close to foreign host
#
0
 

Author Comment

by:rishi_dongre
ID: 9912069
hi lidder,
I m doing the same already. But i m looking for the best way bcos i want to schedule it thru cron.
0
 
LVL 18

Expert Comment

by:liddler
ID: 9912219
#!/bin/ksh
telent 123.23.23.12 1234 < test &
sleep 5
kill $!

As the script that cron calls
i.e. do the telnet, sleep (maybe 5 seconds is too long, or you may not need any sleep), then kill the previous backgroud job (i.e. the telnet)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question