Raised This Month: $12 Target: $400
 3% 

HTTP:X


Post New Thread Reply   
 
Thread Tools Display Modes
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-26-2016 , 16:07   Re: HTTP:X
Reply With Quote #11

If I would include a module I want the whole thing to be a module instead.
But it's never too late. I will see what I can do with it when I get the time.
__________________
Black Rose is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-27-2016 , 12:44   Re: HTTP:X
Reply With Quote #12

It would be just a waste of time for you to code Multi threaded sockets again, + Httpx would be a specific module, and ThreadedSocks will get added into Amxmodx eventually, so since this is a new plugin, i recommend you to even support Threaded mode.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-27-2016 , 16:18   Re: HTTP:X
Reply With Quote #13

What will be added is not interesting. 1.8.3 is not really being released anytime soon. You also have to concider the adaptation. To support all servers I'm aiming for 1.8.2 compatibility. That is still the last "stable" release.
But I've already said I will take a look at it.
__________________

Last edited by Black Rose; 05-27-2016 at 16:29.
Black Rose is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-28-2016 , 15:50   Re: HTTP:X
Reply With Quote #14

lmao xDD
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-29-2016 , 06:24   Re: HTTP:X
Reply With Quote #15

Quote:
Originally Posted by Shooting King View Post
Why don't you make a Multi-threaded solution too instead of entity thinks ? MultiThreadedSocks
Okay. I finally got time to take a look at it. I came to a halt at a point where I realize there's no way of dynamically changing the size of the packets to receive which is a killer for me.
I use 1B when getting the header and scanning for chunk sizes. Other than that I use 64KB. If you want threaded sockets to be included, you have to change this.
__________________
Black Rose is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-29-2016 , 09:55   Re: HTTP:X
Reply With Quote #16

socket_recv_t( const iThreadHandle, const CallBackHandler[], const iRecvDataLen ); ? iRecvDataLen ?

How could you achieve "dynamically changing size" with default sockets ? Could you give me an example to understand your problem better and if possible references in your code ? I guess its better to discuss this issue in Module's thread ?
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 09-14-2016 , 09:16   Re: HTTP:X
Reply With Quote #17

i want to download a file for specific player is there is a way to have played index added to complete handler for now i m looping through all players to find the related player file:
PHP Code:
#include <amxmodx>
#include <httpx>
#include <json>

new g_ClientTrace[33]

public 
plugin_init() {
    
register_plugin("HTTP:X Searching chunks example""2.0""[ --{-@ ]");
}

public 
client_putinserver(id)
{
    new 
sBuffer[128], IP[24
    
    
get_user_ip(id,IP,charsmax(IP),1)
    
    
format(sBuffer127"http://ip-api.com/json/%s"IP)
    
    
g_ClientTrace[id] = HTTPX_Download(sBuffer_"Complete");
}

public 
client_disconnect(id)
{
    
g_ClientTrace[id] = 0
}

public 
Complete(DownloadIDError) {
    if ( 
Error )
    {
        
server_print("Something went wrong...")
        return;
    }
    
    
server_print("file download complete.")
    
    new 
buffer[1024];
    
HTTPX_GetData(buffercharsmax(buffer));
    
    
server_print("Recived Data:%s",buffer)
    
    new 
id GetTracedClient(DownloadID)
    
    if(!
is_user_connected(id))
        return
    
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
    new 
JsonHandle:jroot json_object()
    new 
error_buffer[32]
    
jroot json_loads(bufferJSON_REJECT_DUPLICATESerror_buffersizeof(error_buffer))
    
    if(
jroot == INVALID_JSON)
    {
        
server_print("Coudln't decode json.")
        return
    }
    
    new 
JsonHandle:data json_object()
    new 
country[24],city[24],isp[24]
    
    
data json_object_get(jroot"country")
    if(
data == INVALID_JSON)
    {
        
server_print("Coudln't find country.")
        return
    }
    
json_string_value(datacountrysizeof(country))
    
    
data json_object_get(jroot"city")
    if(
data == INVALID_JSON)
    {
        
server_print("Coudln't find city.")
        return
    }
    
json_string_value(datacitysizeof(city))
    
    
data json_object_get(jroot"isp")
    if(
data == INVALID_JSON)
    {
        
server_print("Coudln't find isp.")
        return
    }
    
json_string_value(dataispsizeof(isp))
    
    
destroy_json(data)
    
destroy_json(jroot)
    
    
server_print("name: %s | country:%s | city:%s | isp:%s",szName,country,city,isp)
}

GetTracedClient(DownloadID)
{
    new 
iPlayers32 ], iNumiTracedClient=0;
    
get_playersiPlayersiNum"ch" );
    for( 
0iNumi++ )
    {
        if(
g_ClientTrace[i] == DownloadID)
        {
            
TracedClient=g_ClientTrace[i]
            break
        }
    }
    
    return 
TracedClient

__________________
JusTGo is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-14-2016 , 15:36   Re: HTTP:X
Reply With Quote #18

Looping through indexes in this way is really no problem at all. I guarantee you that you will never notice a difference.

However I do like the idea of passing and retrieving custom data and I will add this as a feature unless problems arise. The question becomes "how much". Infinite would be nice but that will require dynamic arrays or tries.

A good option could be to enable an integer to be passed where you could supply an array index if you wanted to which would require some more work from the user but will create more freedom without all the back-end.

I will take a look at this ASAP.
Thank you for your suggestion.
__________________

Last edited by Black Rose; 09-14-2016 at 15:38.
Black Rose is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-14-2016 , 16:16   Re: HTTP:X
Reply With Quote #19

If you don't mind making 1.8.3 a requirement, you could use DataPacks, they were made exactly for that.
klippy is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-14-2016 , 17:02   Re: HTTP:X
Reply With Quote #20

I do mind. I'm not developing for unofficial releases. Especially if it doesn't update automatically.
__________________
Black Rose is offline
Reply


Thread Tools
Display Modes

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 04:02.


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