Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-16-2008, 11:35 AM   #1
Registered: Nov 2005
Posts: 91

Rep: Reputation: 17
socket connection. Ideas wanted

I need to be able to run a script on a remote server and have it return information back to me via a network socket connection.

I manage cable modem networks for apartment complexes where the complex's network sits behind a NAT firewall router that is onsite. To monitor individual modems, I need to be able to query them with SNMP. Since I am on the outside of the NAT, this is virtually impossible. I have a provisioning server on the inside of the network that is on the modem's network. Right now I can monitor the modems by connecting to the box via ssh and running several scripts that perform the snmpget's and format the returned data. I need to extend this so that a script located at the main office (outside the network) can perform this task.

All the script will have to do is open the socket to the remote server, pass two parameters (data type and IP to query), and wait for the response. No private information is going to pass over this connection, but a secure connection would still be a plus.

Do I need to look at programming a socket based client-server program from scratch or can SSH be coaxed into this type of duty. Both servers are running linux, so I know I can use shared key authentication.
Old 06-16-2008, 06:16 PM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,395

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
Welel, you could (as you say) use auth keys to connect to the apartment server.
Write a server eg using Perl to recv your request (on the apartment server), do the snmp query and rtn the results to you/local server.
Sounds like you don't need forking or threads, unless you want lots of real-time monitoring.
Also, for worked examples, start here and read down the page :
includes clients and servers using the IO::Socket module that handles all the fiddly bits for you

Edit: actually, that would be a plain text cxn, which for your purposes might be ok. If not, put the relevant cmds in a file on the apartment server and call it using

See also which is prob what you want.
As always, TMTOWTDI

Last edited by chrism01; 06-16-2008 at 06:38 PM.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Network monitoring Ideas wanted here2serve Linux - Enterprise 2 03-27-2008 06:47 PM
LXer: Google Summer of Code 2007 - mentors and project ideas wanted LXer Syndicated Linux News 0 03-09-2007 11:01 PM
connection between java socket and unix socket sathishkumar Programming 1 01-10-2006 03:21 PM
ideas wanted please frieza General 3 02-11-2005 09:37 PM
WANTED: Your ideas for Rescue Linux scuzzman Linux - General 2 12-27-2004 04:19 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:27 AM.

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