Solved

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

Posted on 2003-12-10
7
333 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
  • 3
  • 3
7 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 50 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now