Raised This Month: $ Target: $400
 0% 

Sockets | server hangs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Administrator
Member
Join Date: Jun 2014
Old 12-28-2014 , 09:20   Sockets | server hangs
Reply With Quote #1

Please tell me why the server hangs when sending a message?

PHP Code:
#include <amxmodx>
#include <sockets>

#define MESSAGE "Сообщение"
#define IP "127.0.0.1" // ip сайта
#define DOMAIN "domain.ru" // домен
#define PHP "/vk_message.php" // путь до php скрипта

public plugin_init()
{
    
register_plugin("VK send message""0.1""Stolen")
    
register_clcmd("say /vksend""send");
}

public 
send()
{
    new 
sockerrorpack[128]
    
format(packsizeof(pack), "GET %s?message='%s' HTTP/1.1^nHost:%s^r^n^r^n"PHPMESSAGEDOMAIN)
    
sock socket_open(IP80SOCKET_TCPerror)
    
socket_send(sockpacksizeof(pack))
    
socket_close(sock)

Administrator is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-28-2014 , 11:20   Re: Sockets | server hangs
Reply With Quote #2

2 things I can see that might be the cause is using the single-quotes around the second %s and MESSAGE not being HTML safe. Another cause may be on the receiving end, check to see if the connection even opens

Also, use charsmax instead of sizeof for strings
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 12-28-2014 at 11:21.
YamiKaitou is offline
Administrator
Member
Join Date: Jun 2014
Old 12-29-2014 , 07:12   Re: Sockets | server hangs
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <sockets_hz>

#define MESSAGE "blabla"
#define IP "46.254.21.136" // ip сайта
#define DOMAIN "74pp.ru" // домен
#define PHP "/vk_message.php" // путь до php скрипта

public plugin_init()
{
    
register_plugin("VK send message""0.1""Stolen")
    
register_concmd("vksend""send");
}

public 
send()
{
    new 
sockerrorpack[128]
    
format(packsizeof(pack), "GET %s?message=%s HTTP/1.1^nHost:%s^r^n^r^n"PHPMESSAGEDOMAIN)
    
sock socket_open(IP80SOCKET_TCPerror)
    
socket_send(sockpacksizeof(pack))
    
socket_close(sock)

so do not hang normally do?
Administrator is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 12-29-2014 , 07:17   Re: Sockets | server hangs
Reply With Quote #4

you only have listened one thing he said ._.
baneado is offline
Administrator
Member
Join Date: Jun 2014
Old 12-29-2014 , 07:34   Re: Sockets | server hangs
Reply With Quote #5

sorry, did not understand
Administrator is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-29-2014 , 07:37   Re: Sockets | server hangs
Reply With Quote #6

Code:
sizeof(pack)

Code:
charsmax(pack)

Also, have you tested your new code? Have you looked at the receiving end to see if it is even getting the request?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Administrator
Member
Join Date: Jun 2014
Old 12-29-2014 , 07:41   Re: Sockets | server hangs
Reply With Quote #7

message comes up to me
Administrator is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-29-2014 , 07:57   Re: Sockets | server hangs
Reply With Quote #8

Okay, so then is your issue resolved?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Administrator
Member
Join Date: Jun 2014
Old 12-29-2014 , 08:12   Re: Sockets | server hangs
Reply With Quote #9

Yes, thank you very much
Administrator is offline
Administrator
Member
Join Date: Jun 2014
Old 12-29-2014 , 13:06   Re: Sockets | server hangs
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <sockets_hz>

#define MESSAGE "eeee"
#define IP "46.254.21.136" // ip сайта
#define DOMAIN "74pp.ru" // домен
#define PHP "/vk_message.php" // путь до php скрипта
#define PHPP "/vkk_message.php" // путь до php скрипта

public plugin_init()
{
    
register_plugin("VK send message""0.1""Stolen")
    
register_concmd("vksend""sendd");
}

public 
send()
{
    
sendd()
    new 
sockerrorpack[128]
    
format(packcharsmax(pack), "GET %s?message=%s HTTP/1.1^nHost:%s^r^n^r^n"PHPMESSAGEDOMAIN)
    
sock socket_open(IP80SOCKET_TCPerror)
    
socket_send(sockpackcharsmax(pack))
    
socket_close(sock)
}

public 
sendd()
{
    new 
sockerrorpack[128]
    
format(packcharsmax(pack), "GET %s?message=%s HTTP/1.1^nHost:%s^r^n^r^n"PHPPMESSAGEDOMAIN)
    
sock socket_open(IP80SOCKET_TCPerror)
    
socket_send(sockpackcharsmax(pack))
    
socket_close(sock)

if two messages, the server hangs for 3 seconds
Administrator is offline
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:18.


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