Hi Monks!!!
I'm running a perl script to interface with my Visual Basic 6
program using Winsock. I've got my program setup to connect and works
great if i connect to another winsock program, but it acts funny
connecting to my perl script. The Perl code is below:
#/usr/bin/Perl/ use IO::Socket; $connserver = IO::Socket::INET->new(LocalAddr => '194.163.250.10', LocalPort => '9277', Proto => 'tcp', Listen => 1, Reuse => 1); die "Error in connecting server: $!\n" unless $connserver; print "Waiting to connect...\n"; while($client = $connserver->accept()){ print "Connection success, reading the data...\n"; print <$client>; print "Connection is getting closed...\n"; } $connserver->close();


The script is supposed to do is open a socket on port 9277 for tcp.
Listen for any incomming connections then read the one line of data
comming in. I've read on the internet and in a book
that the above code should work. But they all say the same thing. You
must get the line of data and scan it for a character that lets the perl
script that the line is done. Problem is, when the script runs, i get as
far a connection made then it will do nothing until i close the VB Winsock.
Anyone got a reader for sockets that will know when to stop reading? I
haven't found any examples on the internet on how to do it, just that
everyone says it can be done. It would be helpful for me if any one suggests me!

2006-10-07 Unapproved by planetscape once evidence of habitual plagiarism uncovered.


In reply to Winsock connect problem in perl!!! by madtoperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.