Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Extremely easy to find.

Please reference this link to see the original question by Daniel Moree.

Perl socket problem I'm attempting to use 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: #!c:/Perl/bin/Perl.exe use IO::Socket; $server = IO::Socket::INET->new(LocalAddr => '10.40.0.10', LocalPort => '8777', Proto => 'tcp', Listen => 1, Reuse => 1); die "ERROR: $!\n" unless $server; print "Waiting on connections...\n"; while($client = $server->accept()){ print "Connection made, reading data...\n"; print <$client>; print "Connection closed...\n"; } $server->close(); All the program is supposed to do is open a socket on port 8777 for tc +p. Listen for any incomming connections then read the one line of data comming in. I've read on the internet and in my perl in a nutshell boo +k 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 pe +rl 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 Win +sock. 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. I'd really appreciate the help! Daniel Moree

This is ridiculous.



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

In reply to Re: Winsock connect problem in perl!!! by chargrill
in thread 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-26 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found