Thanks for all your help. I have tried the Proxy method. But I guess I should have explained this part better.
The data that the server is connecting to is streaming out every second none stop.
The client only needs to receive the data no publish back to the server.
I got the blow code to work for a browser, but it hangs on a telnet session unless you hit a key stroke.. Then it comes screaming across.
The data that is coming out does not have a \n or \r or ETX or STX.. it is just there.. I have the code to package and build it. then ship it to the client.. But.. it is getting it to the client that is a pain in code..
#!/usr/local/bin/perl -w
use strict;
use IO::Socket;
use IO::Select;
# create a socket to listen to a port
my $listen = IO::Socket::INET->new(Proto => 'tcp',
LocalPort => 2323,
Listen => 1,
Reuse => 1) or die $!;
my $sk = IO::Socket::INET->new('PeerAddr' => '192.168.3.100', 'PeerPor
+t' =>'4004', 'Proto'=>'tcp') || die "Can't connect";
# to start with, $select contains only the socket we're listening on
my $select = IO::Select->new($listen);
my @ready;
# wait until there's something to do
while(1) {
if(@ready = $select->can_read(0)){
my $socket;
# handle each socket that's ready
for $socket (@ready) {
# if the listening socket is ready, accept a new connection
if($socket == $listen) {
my $new = $listen->accept;
$select->add($new);
print $new->fileno . ": connected\n";
}
else {
# otherwise, read a line of text and send it back again
my $line;
my $lineB;
$sk->recv($line, 1024);
$socket->recv($lineB,1);
$lineB=length($lineB);
print "length ",length($lineB),"\n";
print "Ord ",ord($lineB),"\n";
print "Revc ",$lineB,"\n";
if($lineB > 0){
print "Hello\n";
$socket->send($line);
}
}
}
}
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.