Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Perlscript ➜ Perl Socket Minibrowser

Perl Socket Minibrowser

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by MattMc   USA  (54 posts)  Bio
Date Tue 29 Jun 2004 12:42 PM (UTC)

Amended on Tue 29 Jun 2004 03:52 PM (UTC) by MattMc

Message
Howdy,

Below is a script I'm trying to get to work, but can't seem to figure it out. I admit my native language is php, then vbasic, and then a few other things before I get to perl so I'm really nieve on this language. Below is just the script, not the xml because I do know that much so I won't waste your time by making you flip through there.

I had a friend get this for me, so it may just not be mushclient compatable in its currently writen form. If someone can help me by pointing out the errors on it, or if you have the time to rewrite it that would also be cool, but I just need some guidence.

The object of the script is to seek a website, and return in the @output array the contents of the page. This is used to interface my computer to a php script on a different server so I can post data there, and then return errors or status reports on that post.


see below
Top

Posted by MattMc   USA  (54 posts)  Bio
Date Reply #1 on Tue 29 Jun 2004 03:51 PM (UTC)

Amended on Tue 29 Jun 2004 05:21 PM (UTC) by MattMc

Message
Now that I'm awake... Here's the full file because it actually would help you to see it all after I made some fixes that were pretty obvious. Plus I've included the error I get.


see below
Top

Posted by MattMc   USA  (54 posts)  Bio
Date Reply #2 on Tue 29 Jun 2004 05:23 PM (UTC)
Message

<script>
<![CDATA[
sub GetHTTP {
  my ($thename, $theoutput, $wildcards) = @_;
  my ($remote, $doc, $port, $iaddr, $paddr, $proto, $line,@output);
  $remote = $world->GetTriggerInfo ($thename,101);
  $doc = $world->GetTriggerInfo ($thename,102);
  $port = 80;
  $sockaddr = 'S n a4 x8';
  if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
  die "No port" unless $port;
  $thisaddr   = gethostbyname("localhost");
  $thataddr   = gethostbyname($remote);
  $this   = pack($sockaddr, AF_INET, 0, $thisaddr);
  $that   = pack($sockaddr, AF_INET, $port, $thataddr);

  $proto   = getprotobyname('tcp');
  socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
  bind(SOCK, $this)    || die "bind: $!";
  connect(SOCK, $that)    || die "connect: $!";
  select(SOCK); $| = 1; select(STDOUT);

do { $line = <SOCK> } until ($line =~ /^\r\n/); 
   @output = <SOCK>; 
   close (SOCK) || die "close: $!";
}
]]>
</script>

Poco y poco I'm making my way through, but I think I'm seriously stuck this time :D The bind function isn't recognized.

Error number: -2147467259
Event: Execution of line 1 column 0
Description: bind: Unknown error at (eval 2) line 17.

Called by: Function/Sub: GetHTTP called by trigger
Reason: processing trigger "gethttptrig"
Top

Posted by MattMc   USA  (54 posts)  Bio
Date Reply #3 on Tue 29 Jun 2004 06:07 PM (UTC)

Amended on Tue 29 Jun 2004 06:10 PM (UTC) by MattMc

Message
Upgraded ActivePerl and same errors.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Wed 30 Jun 2004 03:05 AM (UTC)
Message
If I were to hazard a complete guess on this, it would be that the perl scripting engine can't handle networking. Sorry that I can't help you more than that.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


20,301 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.