Perl Script Listening On A TCP Port


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl Script Listening On A TCP Port
# 1  
Old 12-04-2001
Tools Perl Script Listening On A TCP Port

Hi,

Im programming a perl script which will act as a daemon listening on a tcp port (2323) and will take (<stdin>) from the client (im going to use telnet) and run the arguments from (<stdin>) against an program already on the server, which is used to list books in the library at uni.

So far my script looks like this:

#!/hari/library/local/bin/perl

print "library> ";
$arguments = (<STDIN>);

As you can see i havent got very far and need some help with the sockets.

This is how i want the daemon-perl-script to function.

Listen on port 2323
If a connection comes in print out some stuff and a promt for a command like 'library>'
take any arguments from (<stdin>) and run them against a command, i think passthru can do that:

passthru( "/some/program \"$arguments\"" );

and then send the output from the program to <stdout>
and finaly print another prompt letting the user know they can type another command.

Sorry if this is really boring, but i cant find any sockets tutorials for perl,

Also in a perl script when i run system( "clear " ) it doesnt clear <stdout>, is there a way i can do this?

Cheers,

Elfyn

If there are words missing where there are just () its suppost to be stdin/stdout but its being strippen as html

Last edited by emcb; 12-04-2001 at 07:59 PM..
emcb
# 2  
Old 12-05-2001
Sorry I don't know the answer but you might want to check perlmonks.com. They have always helped me with complex perl questions in the past.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Rpcbind Listening on a Non-Standard Port

Hello, I was trying to find information about below rpcbind issue and how can I fix it so that, it wont happen again. Below is the one of the vulnerability from my security team, RPC service name: portmapper service protocal: udp Portmapper found at: 327xx service port: 327xx ... (2 Replies)
Discussion started by: system.engineer
2 Replies

2. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

3. IP Networking

How to find if remote n/w port is listening on HP-UX from the binary

Hi, I have an executable running on HP-UX, from this executable I need to findout if the portnumber. lets say 7890,7891, 7892 are listening on the remote server running on HP-UX. I can do it by creating socket, connect etc. But is there any other way of doing it using "system()" function or... (3 Replies)
Discussion started by: einsteinBrain
3 Replies

4. Cybersecurity

Listening to port when no IP address is assigned

Hi Pals Consider a case where the network interface is there and it is connected to a network. Only thing left here is I need to set a static ip/ip though dhcp (though ifconfig) I heard that it is possible to listen even if the ip address is not set. So is there any possibility of an attack over... (1 Reply)
Discussion started by: sreejithc
1 Replies

5. Shell Programming and Scripting

Find file that maps to a listening port

On my VPS server I have a port that is open and is listening for a 'status' command when you connect to it to like so... $ telnet host 1900 Trying host... Connected to host. Escape character is '^]'. status QMAIL;OK APACHE;OK HTTPD;OK CRON;OK Wondering if what command I can attempt... (2 Replies)
Discussion started by: phpfreak
2 Replies

6. SCO

/dev/inet/tcp not listening in SCO 6.

While in SCO Openserver 5.0.7, Sybase listened to /dev/inet/tcp, the same is not working in SCO Openserver 6. The Network card is however active and pinging fine. What can be the reason? What is the way out? An early response will be appreciated. Thank you Regards TCG (2 Replies)
Discussion started by: thecobolguy
2 Replies

7. Programming

tcp server listening, client connecting problems

hello everyone. I tried searching for something related to this, but I figured it was time to ask my own question. I am experiencing these problems using Ubuntu 7.04 I am starting up a TCP listener/server and once connected, will act as a communication/control link with a program on another... (3 Replies)
Discussion started by: pjwhite
3 Replies

8. Shell Programming and Scripting

Listening on port for incoming data?

I am not what I would call an experienced programmer. I know some ksh etc.. I need to be able to listening on a port for incoming data on a ultra 10 using solaris 9. Basically all that I need to do at the moment is to log the incoming data on a specific port number. Any ideas on how I... (6 Replies)
Discussion started by: frustrated1
6 Replies

9. UNIX for Dummies Questions & Answers

TCP Listening Ports

Hello all, Can someone instruct me on how to change the listening port for ftp ( or any tcp service) from 21 to another port number? Thanks in advance.. -AJ (3 Replies)
Discussion started by: jacobsa
3 Replies

10. IP Networking

port not listening..

Hi.. I am using HPux11.0 i want to know if server not listening to a tcp port what should we do to resolve the problem.... in /etc/services tcp port 7108/tcp is mentioned for some perticular application.. while starting that application error is coming could not establish listening address... (1 Reply)
Discussion started by: Prafulla
1 Replies
Login or Register to Ask a Question