Hiya everyone. Just thought that maybe someone could help me out on this one.
I'm making a client on perl using IO::Socket and it works for most of my apps.
But i came upon a bit of a challenge here. Everything works fine. I'm sending the login packet to YCHT perfectly and yahoo is logging me in on the chat server. The problem is i only get my reply when yahoo logs me off. Im replying to every SYN/ACK resplies of yahoo server but still i dont get my data in real time. I end up getting the messenger info, chat room info after it logs me off and drops the connection.
here's the code(Full source not included..... sloppy packet encryption, too shy to post, LMAO!!)
Now i dont have a problem like this on my IRC client which uses the same format though.
Could it be i'm missing something???
sub ychat() {
my $packet=$_[0];
my $packlen=$_[1];
my $packhand=$_[2];
my $ycht='jcs.chat.dcn.yahoo.com';
my $chtport=8001;
if ($packet,$packlen,$packhand){
my $whole_packet=YCHT->create_packet($packet,$packlen,$packhand);
if ($whole_packet ne 'VALID') {
die "$whole_packet \n";
}
}
else{
die "Missing ARGS\n";
}
###Start connection to chat server ####
print "trying to connect to $ycht\n";
my $chat=IO::Socket::INET->new(
PeerHost=>$ycht,
PeerPort=>$chtport,
Proto=>'tcp',
SockPort=>3505,
) || die "could not connect to chat server\n";
$chat->autoflush(1);
print STDERR "connection established\nsending data\n";
print $chat $whole_packet;
print STDERR "data sent waiting for reply\n";
while(defined($incoming=<$chat>)) {
##This will slow me down, but i need the packets in real time.
while(sysread($incoming,$byte,2)==1) {
print STDOUT "got reply \n";
print "$byte\n";
close $chat;
}
}
return;
}
anyways, anyone got an idea on what im missing ?