473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question on opening a Socket

25
Hi,
I am working as a software test engineer(testing docsis compliant devices like cable modem). I have done Perl programming involving hashes, files, regex and modules. But right now, I have to automate a task which involves opening a socket. (which I have not done before)

Here is the problem:-

From my Linux server, I have to open a connection to another windows PC which is on the same network.
After getting to that PC, I have to open a web page http://192.168.100.1 (which is the diagnostic web page for the modem) It will ask for authentication. I have to enter my username and password.
After going to that web page there is an option called backup. Basically I have to click that and upload the file that I have in my script.

This is my question:-
Is it possible in Perl or should I use someother language?
Any tips or suggestions on how to approach this problem?

I would apreciate your response.

Thanks,
san
Oct 17 '07 #1
3 1388
eWish
971 Expert 512MB
Not experienced in this category. Sorry -:(

A good start would possibly be perlipc. Another good place would be to look at CPAN. All else fails try Google.
Oct 18 '07 #2
KevinADC
4,059 Expert 2GB
Perl comes with IO::Socket which seems like a logical place to start.
Oct 18 '07 #3
Hi,

Following code is an easy code to start with sockets. This code opens a socket connection with a HTTP server and gets back a file from it.

Expand|Select|Wrap|Line Numbers
  1. # -----------------------------------------------------
  2. use IO::Socket;
  3.  
  4.     $host = "www.google.com" ;
  5.     $document = "/index.html" ; 
  6.     $BLANK = "\n\n\n" ;
  7.  
  8.         $remote = IO::Socket::INET->new( Proto     => "tcp",
  9.                                          PeerAddr  => $host,
  10.                                          PeerPort  => "http(80)",
  11.                                         );
  12.         unless ($remote) { die "cannot connect to http daemon on $host" }
  13.         print "Socket object created\n" ;
  14.         $remote->autoflush(1);
  15.         print "Autoflush done\n" ;
  16.         print $remote "GET $document HTTP/1.0"  . $BLANK;
  17.         print "Request written\n" ;
  18.         while ( <$remote> ) { print }
  19.         close $remote;
  20. # -------------------------------------------------------------
  21.  
the username/password thing you mentioned, need to be worked out. But this can be a starter.

Regards
Oct 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Guillaume Brocker | last post by:
Hi ! I'm opening a socket to a web server on port 80 located on my LAN with fsockopen. The socket creation fails and PHP returns "php_network_getaddresses: getaddrinfo failed: Name or service...
2
by: Martin Fuzzey | last post by:
I am using xmlrpclib (based on httplib) in Python 2.3 on Mandrake Linux. When my client attempts to connect to a server using a "http://localhost:port" style URL there is a long delay before the...
8
by: John Burton | last post by:
I'm not sure if this is a question about python socket support or sockets in general ... I have a socket server with which I want to accept incoming connections on ipv4 and ipv6. I've found...
0
by: Nicolas Bruneau | last post by:
Hello, I open a SSL socket IO::Socket::SSL module, sending data, received data, and then closed with the shutdown(2) function. Everything is ok untill the loop number 254, that makes the script...
1
by: Daniel | last post by:
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" what am i doing wrong? is there some thing else i need to do to free up the socket...
1
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
4
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
2
by: Dave Dean | last post by:
Hi all, I'm just starting out in sockets/network programming, and I have a very basic question...what are the 'security' implications of opening up a socket? For example, suppose I've written a...
2
by: Ali Hamad | last post by:
Hello All : A socket question from a networking newbie. I need to create a server that: 1) receive a message from client. 2) check that message and response to it. 3) the client get the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.