This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Detect socket connection lost


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 07-29-2011 , 13:12   Detect socket connection lost
Reply With Quote #1

I have server which is connecting to socket server...
When socket server goes down my server crushes.
How can I fix this?
Code:
if (socket_change(g_Socket, 1))
    {
        socket_recv(g_Socket, g_Data, 1999)
        
        if(equal(g_Data, "") || equali(g_LastPack, g_Data))
        {
            if(equal(g_Data, "") || g_lpbr == 2)
            {
                socket_close(g_Socket)
                g_LastPack = ""
                g_lpbr = 0
                return PLUGIN_HANDLED
            }else {
                g_lpbr++
            }
        }else {
            g_LastPack = g_Data
        }
I've noticed when I use server on local machine that when connection hangs that g_Data repeats so I used this if g_Data repeats 2 times that means that connection is dead but it doesn't work when I use this plug on hosted server
AoD90 is offline
Send a message via MSN to AoD90
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode