[Plugin] Socket plugin (v0.2b released)

It's possible to communicate in php file i need in one time get everything. for ex:

User press button and calls php file:

Code:
<?php

?>
I need to send what i want my data name, money and so on so server do some checks and send again results to same php file and instantly get results

Code:
<?php
--------> Send to sa-mp server data
<------- retrieve from server results
Just in one php file instantly send,get results
?>
Code:
$.post("http://i call to my website php file", {name: name}, function( data )
{

} );
Reply

Quote:
Originally Posted by maddinat0r
View Post
Recompiled the plugin on Debian 8 x86-64 with the newest libssl package: socket.so
Still getting

[15:03:03] Failed (libcrypto.so.1.0.0: cannot open shared object file: No such file or directory)

Ubuntu 14.04 LTS
libssl1.0.0
x86_64
Reply

I had a similar issue with ubuntu 14.04, I will quote the solution that I found somewhere:

QUOTE:
Failed (libssl.so.0.9.8: cannot open shared object file: No such file or directory)
I just ran into this problem myself. The vmware-vdiskmanager needs i386 libraries.
sudo aptitude install libssl0.9.8:i386
If that by itself doesn't solve the problem, look at other related i386 libs.
Shane
Reply

I've tried all of that.


sudo: unable to resolve host kcnr
Couldn't find any package whose name or description matched "libssl0.9.8:i386"
Couldn't find any package whose name or description matched "libssl0.9.8:i386"
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.


there is no libssl1.0.0:i386 either but madin said he compiled for 64 bit.. so I'm wondering how come it's still telling me this stuff.
Reply

I will check on my server during the day and see how I managed to fix this. This is a standard issue for me whenever I reinstall ubuntu on my dedi.
Reply

There is a libssl1.0.0 package (i386) on Ubuntu Trusty: http://packages.ubuntu.com/trusty/libssl1.0.0
Reply

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
To eliminate human error, what is the contents of your plugins/ folder and what is the contents of your server.cfg?
Код:
plugins crashdetect sscanf streamer mysql pawncmd socket


Okay?
Basically, it's there...
Reply

You might be missing a dll. Use dependency walker
Reply

None else haven't had this problem before?
Reply

My server is going offline after i try to send some data with socket_send()

Код:
public onSocketRemoteConnect(Socket:id, remote_client[], remote_clientid)
{
	printf("Dolazeca konekcija sa [%d:%s]", remote_clientid, remote_client); // [id:ip]
	if(is_socket_valid(id)) socket_send(id, "Welcome :)", strlen("Welcome :)"));
	return 1;
}
Reply

Anyone have any idea why this happens? I'm trying to connect my web chat page (which is hosted in the website host) to the .pwn script (which is hosted in the VPS) but it doesn't work properly, It doesn't even show if the socket connected or not in the console.
I have tested it in the localhost and it worked flawless. I tried contacting the hosters, they told me the ports are already opened, here's my codes:

PHP код:
// .PWN script
    
gSocket socket_create(TCP);
    if(
is_socket_valid(gSocket)) {
        
socket_set_max_connections(gSocketMAX_PLAYERS);
        
socket_bind(gSocket"SERVERIP");
        
socket_listen(gSocket7778);
    } 
PHP код:
// PHP Script
            
set_time_limit(0);
            
ob_implicit_flush();
         
            
$address 'SERVERIP';
            
$port 7778;
            
socket_connect($socket$address$port); 
I don't get it, what IP should I use? Server IP or the website IP?
Any help would be appreciated, thanks in advance.
Reply

Quote:
Originally Posted by Omirrow
Посмотреть сообщение
None else haven't had this problem before?
Encountered the same issue on a clean setup, wondered why 0.2b ain't loading, even tho I had it in my dir/
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:11] 
[18:55:11] Server Plugins
[18:55:11] --------------
[18:55:11]  Loading plugin: crashdetect
[18:55:11]   CrashDetect v4.18.1 is OK.
[18:55:11]   Loaded.
[18:55:11]  Loading plugin: socket02b
[18:55:11]   Failed.
[18:55:11]  Loaded 1 plugins.

[18:55:11] 
[18:55:11] Filterscripts
[18:55:11] ---------------
[18:55:11]   Loaded 0 filterscripts.

[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] Script[gamemodes/socket.amx]: Run time error 19: "File or function is not found"
[18:55:11] Number of vehicle models: 0

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:19] 
[18:55:19] Server Plugins
[18:55:19] --------------
[18:55:19]  Loading plugin: crashdetect
[18:55:19]   CrashDetect v4.18.1 is OK.
[18:55:19]   Loaded.
[18:55:19]  Loading plugin: socket01b
[18:55:19]  Socket plugin v0.1b loaded.
[18:55:19]   Loaded.
[18:55:19]  Loaded 2 plugins.

[18:55:19] 
[18:55:19] Filterscripts
[18:55:19] ---------------
[18:55:19]   Loaded 0 filterscripts.

[18:55:20] socket_connect(): Socket ID 0 has failed to connect.
[18:55:20] socket_listen(): Socket has failed to bind on port 7776.
[18:55:20] Socket Test Gamemode main
[18:55:20] Number of vehicle models: 0
Reply

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
Encountered the same issue on a clean setup, wondered why 0.2b ain't loading, even tho I had it in my dir/
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:11] 
[18:55:11] Server Plugins
[18:55:11] --------------
[18:55:11]  Loading plugin: crashdetect
[18:55:11]   CrashDetect v4.18.1 is OK.
[18:55:11]   Loaded.
[18:55:11]  Loading plugin: socket02b
[18:55:11]   Failed.
[18:55:11]  Loaded 1 plugins.

[18:55:11] 
[18:55:11] Filterscripts
[18:55:11] ---------------
[18:55:11]   Loaded 0 filterscripts.

[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] Script[gamemodes/socket.amx]: Run time error 19: "File or function is not found"
[18:55:11] Number of vehicle models: 0

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:19] 
[18:55:19] Server Plugins
[18:55:19] --------------
[18:55:19]  Loading plugin: crashdetect
[18:55:19]   CrashDetect v4.18.1 is OK.
[18:55:19]   Loaded.
[18:55:19]  Loading plugin: socket01b
[18:55:19]  Socket plugin v0.1b loaded.
[18:55:19]   Loaded.
[18:55:19]  Loaded 2 plugins.

[18:55:19] 
[18:55:19] Filterscripts
[18:55:19] ---------------
[18:55:19]   Loaded 0 filterscripts.

[18:55:20] socket_connect(): Socket ID 0 has failed to connect.
[18:55:20] socket_listen(): Socket has failed to bind on port 7776.
[18:55:20] Socket Test Gamemode main
[18:55:20] Number of vehicle models: 0
It can't be the plugin it works fine, do you have microsoft visuals and all that?

My O/S: Windows 10 (Works fine on Centos 7 also)

Код:
 Socket plugin v0.2b loaded.
  Loaded.
[Socket]: Connection listening on IP: 127.0.0.1 | port 7780.
Reply

can someone tell me if the callback
PHP код:
public onSocketRemoteDisconnect(Socket:idremote_clientid
is working properly?
Seems like this one is never getting called on the server when i close the socket connection at the client side.

Is is working for you guys?
If so, what do i have to do on client side so this callback gets called?


thanks!
Reply

Hi,

i have an issue with this plugin.
The server seems to close connections to the connected clients randomly (gmx/restart of the server is not triggered)

This is my pawn code where i bind and listen for connections/data:
pawn Код:
#include <a_samp>
#include <socket>

new Socket:CLIENT_SOCKET;
#define SOCKET_PORT 7785
#define SOCKET_MAX_CONNECTION 25

new connected_remote_clients;

public OnGameModeInit()
{
    new ip[16];
    GetServerVarAsString("bind", ip, sizeof (ip));
   
    connected_remote_clients=0;
   
    CLIENT_SOCKET = socket_create(TCP);
    if(is_socket_valid(CLIENT_SOCKET))
    {
        socket_set_max_connections(CLIENT_SOCKET, SOCKET_MAX_CONNECTION);
        socket_bind(CLIENT_SOCKET, ip);
        socket_listen(CLIENT_SOCKET, SOCKET_PORT);
    }
    return 1;
}

public OnGameModeExit()
{
    if(is_socket_valid(CLIENT_SOCKET))socket_destroy(CLIENT_SOCKET);
    return 1;
}

public onSocketRemoteConnect(Socket:id, remote_client[], remote_clientid)
{
    connected_remote_clients++;
    return 1;
}

public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
{
    print(data);
    SendSocketMessageToAllClients(data);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    SendSocketMessageToAllClients(text);
    return 1;
}

forward SendSocketMessageToAllClients(socket_message[]);
public SendSocketMessageToAllClients(socket_message[])
{
    for(new client_i=0; client_i<connected_remote_clients; client_i++)
    {
        if(is_socket_valid(CLIENT_SOCKET))socket_sendto_remote_client(CLIENT_SOCKET, client_i, socket_message);
    }
    return 1;
}
I made an app (=client) that connects to the server chat.
Works just fine.
BUT, from time to time (totally random it seems), i get this error message on the client side:
PHP код:
[Errno 10054An existing connection was forcibly closed by the remote host
Seems like the server randomly closes the conenction to my clients?
Can you give me a hint where to look for the bug?
Or is it another bug by the plugin, an issue you already know about?

Someone experienced this before?
Im running this on linux.

Thank you!
Reply

If someone could maintain this plugin :\
Reply

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
Encountered the same issue on a clean setup, wondered why 0.2b ain't loading, even tho I had it in my dir/
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:11] 
[18:55:11] Server Plugins
[18:55:11] --------------
[18:55:11]  Loading plugin: crashdetect
[18:55:11]   CrashDetect v4.18.1 is OK.
[18:55:11]   Loaded.
[18:55:11]  Loading plugin: socket02b
[18:55:11]   Failed.
[18:55:11]  Loaded 1 plugins.

[18:55:11] 
[18:55:11] Filterscripts
[18:55:11] ---------------
[18:55:11]   Loaded 0 filterscripts.

[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] [debug] Run time error 19: "File or function is not found"
[18:55:11] [debug]  socket_create
[18:55:11] [debug]  is_socket_valid
[18:55:11] [debug]  socket_connect
[18:55:11] [debug]  socket_set_max_connections
[18:55:11] [debug]  socket_listen
[18:55:11] [debug]  socket_destroy
[18:55:11] [debug]  socket_send
[18:55:11] Script[gamemodes/socket.amx]: Run time error 19: "File or function is not found"
[18:55:11] Number of vehicle models: 0

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:55:19] 
[18:55:19] Server Plugins
[18:55:19] --------------
[18:55:19]  Loading plugin: crashdetect
[18:55:19]   CrashDetect v4.18.1 is OK.
[18:55:19]   Loaded.
[18:55:19]  Loading plugin: socket01b
[18:55:19]  Socket plugin v0.1b loaded.
[18:55:19]   Loaded.
[18:55:19]  Loaded 2 plugins.

[18:55:19] 
[18:55:19] Filterscripts
[18:55:19] ---------------
[18:55:19]   Loaded 0 filterscripts.

[18:55:20] socket_connect(): Socket ID 0 has failed to connect.
[18:55:20] socket_listen(): Socket has failed to bind on port 7776.
[18:55:20] Socket Test Gamemode main
[18:55:20] Number of vehicle models: 0
libeay32 and ssleay32 missing just add these dlls and it supposed to work fuine. [ had same issue did that and tested on two pcs with different windowses worked fuine on both. ]
attached them below.
Reply

By the way, these are files from OpenSSL.


Probably are required because in 0.2b SSL support was added?
Reply

Amazing, thanks!
Reply

Quote:
Originally Posted by haoss
View Post
Another late response, is there any news on this project ? I've already got my user panel and server setuped using this and now i'm experiencing random crashes.
Thanks.
There aren't and probably won't be, BlueG haven't replied to any of the replies and no one other than him maintance the plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)