Openkore.com

OpenKore Forums
It is currently 09 Dec 2018, 22:45

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: setting TCP_NODELAY
PostPosted: 13 Sep 2015, 03:36 
Offline
Noob
Noob

Joined: 08 Nov 2011, 05:57
Posts: 6
It might be better to set TCP_NODELAY in src/Network/DirectConnection.pm such as :

Code:
use Socket;


then

Code:
##
# $net->serverConnect(String host, int port)
# host: the host name/IP of the RO server to connect to.
# port: the port number of the RO server to connect to.
#
# Establish a connection to a Ragnarok Online server.
#
# This function is used internally by $net->checkConnection() and should not be used directly.
sub serverConnect {
        my $self = shift;
        my $host = shift;
        my $port = shift;
        my $return = 0;

        Plugins::callHook('Network::connectTo', {
                socket => \$self->{remote_socket},
                return => \$return,
                host => $host,
                port => $port
        });
        return if ($return);

        message TF("Connecting (%s:%s)... ", $host, $port), "connection";
        $self->{remote_socket} = new IO::Socket::INET(
                        LocalAddr       => $config{bindIp} || undef,
                        PeerAddr        => $host,
                        PeerPort        => $port,
                        Proto           => 'tcp',
                        Timeout         => 4);
        setsockopt($self->{remote_socket}, &Socket::IPPROTO_TCP, &Socket::TCP_NODELAY, 1);
        $self->{remote_socket}->setsockopt(&Socket::IPPROTO_TCP, &Socket::TCP_NODELAY, 1);
        ($self->{remote_socket} && inet_aton($self->{remote_socket}->peerhost()) eq inet_aton($host)) ?
                message T("connected\n"), "connection" :
                error(TF("couldn't connect: %s (error code %d)\n", "$!", int($!)), "connection");
        if ($self->getState() != Network::NOT_CONNECTED) {
                $incomingMessages->nextMessageMightBeAccountID();
        }
}


Thoughts?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group