LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-14-2004, 08:48 AM   #1
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Rep: Reputation: 15
How to make a program to listen on a Particular port


I have writen a script .I wanted it to listen on a particular port in my machine.How to do that?.
For eaxmple Every one tried to connect to that port should be welcomed with a message,
#!/bin/bash
echo "welcome to my port"
.How to do that?
 
Old 04-14-2004, 11:39 AM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
Netcat is a nifty utility that should be used with care. You can have it listening on an arbitrary port (non-reserved if you're not root, of course) and do all sorts of tricks. A trojan in a box.
nc -l -p 62000 < textfile will present the contents of the file "textfile" to everyone who connects to tcp/62000.


Håkan
 
Old 04-14-2004, 12:08 PM   #3
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
I am not particular abt textfile.anything like How the progrmmers are making their program listening on particular port.Thats what I want to know.Anyhow Thanks for ur info.I will try that
 
Old 04-14-2004, 01:35 PM   #4
WeNdeL
Member
 
Registered: Oct 2002
Location: At my desk...
Distribution: RedHat, Fedora, Ubuntu
Posts: 344

Rep: Reputation: 30
xinetd may help you...
 
Old 04-14-2004, 07:43 PM   #5
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
Then I suggest you check out socket programming in C to get it thoroughly done. Java also provides excellent and very simple classes and methods for networking.

Or you could read up on netcat.


Håkan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Port 80 listen without WebServer? hacinn Linux - Security 5 06-30-2004 10:52 PM
Port won't Listen dvong3 Linux - Networking 4 05-12-2004 01:18 PM
Can vsftpd listen to another port? twelve Linux - Networking 9 05-05-2004 09:13 PM
how to change wu-ftp listen port? jamil5454 Linux - Networking 3 01-05-2004 08:07 AM
Need help fast. How do I get sendmail to listen on port 25? 360 Linux - Networking 6 05-21-2002 12:15 PM


All times are GMT -5. The time now is 06:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration