[Plugin] [BETA] SA:MP Sockets Plugin
#41

Cool, Cool
Reply
#42

error in sockets.inc
forward OnSocketReceive(data[], address[], port);
in sample pwn
public OnSocketRecieve(data[], address[], port)

in this topic
Quote:
Originally Posted by StrickenKid
Посмотреть сообщение
  • forward OnSocketRecieve(data[], address[], port)
    • This callback gets called when data has been received from the connected socket.
fixed please, boner "public function lacks forward declaration (symbol "OnSocketRecieve")"
Reply
#43

This event doesn't work Please, fix it
Reply
#44

fix link not work
Reply
#45

link is down
Reply
#46

Ohh noo!
Link is down!
Pls reupload
I need this
Reply
#47

reupload
Reply
#48

Link will be up within the next hour (DNS change)
Reply
#49

where working links?
what autor waiting for?
Reply
#50

Still not working. ;[
Reply
#51

The server is back up.
Reply
#52

Hey! Linux version failed to run, see it:

Failed (plugins/sockets.so: undefined symbol: sock)

I put this correctly in the server.cfg:

plugins sockets.so
Reply
#53

This is gonna be very useful.
[Socket] Successfully connected to: mail.venturas-cnr.com:25.
Reply
#54

How to use this function , someone example or tutorial plz??
socket_send
Reply
#55

And I'm kinda stuck already. My problem is that OnSocketReceive isn't being called (or I'm doing something wrong).
When connecting to my mail server, there should be some data sent back, but there's none.

pawn Код:
main()
{
    socket_connect("mail.venturas-cnr.com", 25);
    // prints: [20:13:03] [Socket] Successfully connected to: mail.venturas-cnr.com:25.
}

public OnSocketReceive(data[], address[], port)
{
        printf("OnSocketReceive Called!");
        // Prints: Nothing
   
        printf(data);
        // Prints: Nothing
        // Should print: 220 nl.webserver.serverffs.com ESMTP Exim 4.69 Mon, 24 Jan 2011 20:06:01 +0100
   
    new
        responsecode,
        message[256];
       
    sscanf(data, "ds[256]", responsecode, message);
   
    return 1;
}
Mailserver, username, password, etc is fine. I tested with Putty.
Reply
#56

plugins/sockets.so: undefined symbol: sock
Reply
#57

Hello my friends!
I have a terrible problem!
When I send to the client:
Код:
public OnSocketConnect(address[], port)
{
    socket_send("Sing Alleluja!");
    socket_close();

	return 1;
}
Receives:
Sing Alleluja!╠╠╠╠╠╠╠╠╠╠X←

╠╠╠╠╠╠╠╠╠╠X←
:O WTF?!

You know what is the cause?

Please help
Reply
#58

Nice
Reply
#59

When I connect 2 servers, nothing happends, first it closed the connection again because the server i connected to was thinking the incoming connection was 127.0.0.1 (localhost)

So i removed that part of the code, but now still nothing happends.

I got the codes and belonging logs down here:
Log from my laptop:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3c, ©2005-2010 SA-MP Team


Server Plugins
--------------
 Loading plugin: sockets
 SA:MP Sockets Plugin BETA R2 Loaded.
  Loaded.
 Loaded 1 plugins.


Started server on port: 7777, with maxplayers: 12 lanmode is ON.


Filter Scripts
---------------
  Loaded 0 filter scripts.


----------------------------------
 TruckersLife v.1.5a
----------------------------------

Number of vehicle models: 75
loadfs SocketClient
[Socket] Successfully connected to: 192.168.1.100:7788.
Connected to Server
  Filterscript 'SocketClient.amx' loaded.
Incoming connection: 127.0.0.1:56580
[join] Chicken has joined the server (0:127.0.0.1)
[user] Account file loaded for Chicken(0)
[chat] [Chicken]: hi
[Socket] Debug: Function socket_send sent "Chicken says:hi".
[user] Account file saved for Chicken(0)
[part] Chicken has left the server (0:1)
Incoming connection: 127.0.0.1:63333
[join] Chicken has joined the server (0:127.0.0.1)
[user] Account file loaded for Chicken(0)
[chat] [Chicken]: test
[Socket] Debug: Function socket_send sent "Chicken says:test".
[chat] [Chicken]: test
[Socket] Debug: Function socket_send sent "Chicken says:test".
[user] Account file saved for Chicken(0)
[part] Chicken has left the server (0:1)
Code from my laptop
pawn Код:
#include <a_samp>
#include <sockets>

#define PORT 7788
#define COLOR_LINK 0xFFFAFAAA

forward OnSocketRecieve(data[], address[]);

public OnSocketConnect(address[])
{
    if ( strcmp(address, "127.0.0.1") != 0 ) // not a local connection!
    {
        socket_close();
        print("[socket] Client tried to connect to itself! Connection rejected!");
    }
    return 1;
}

public OnSocketRecieve(data[], address[])
{
    new string[160];
    format(string, sizeof(string), "[%s] %s", address, data);
    print(string);
    SendClientMessageToAll(COLOR_LINK, string);
    return 1;
}

public OnFilterScriptInit()
{
    socket_connect("192.168.1.100", PORT);
    print("Connected to Server");
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[160];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "%s says:%s", Name, text);
    socket_send(string);
    return 1;
}

Log from my server:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3c, ©2005-2010 SA-MP Team


Server Plugins
--------------
 Loading plugin: sockets
 SA:MP Sockets Plugin BETA R2 Loaded.
  Loaded.
 Loaded 1 plugins.


Started server on port: 7777, with maxplayers: 12 lanmode is ON.


Filter Scripts
---------------
  Loading filter script 'SocketServer.amx'...
  Loaded 1 filter scripts.


----------------------------------
 TruckersLife v.1.5a
----------------------------------

Number of vehicle models: 75
[Socket] Started listening on port 7788.
[Socket] Incomming connection from: 192.168.1.144:60613.
Incoming connection: 192.168.1.144:63334
[join] Chicken has joined the server (0:192.168.1.144)
[user] Account file loaded for Chicken(0)
[chat] [Chicken]: test
[Socket] Debug: Function socket_send sent "Chicken says:test".
[user] Account file saved for Chicken(0)
[part] Chicken has left the server (0:1)
Code from my server:
pawn Код:
#include <a_samp>
#include <sockets>

#define PORT 7788
#define COLOR_LINK 0xFFFAFAAA

forward OnSocketRecieve(data[], address[]);

main()
{
    print("\n----------------------------------");
    print("  Wormhole test loaded [SERVER]\n");
    print("----------------------------------\n");
}

public OnSocketConnect(address[])
{
    if ( strcmp(address, "127.0.0.1") != 0 ) // not a local connection!
    {
        socket_close();
        print("[socket] Server tried to connect to itself! Connection rejected!");
    }
    return 1;
}

public OnSocketRecieve(data[], address[])
{
    new string[160];
    format(string, sizeof(string), "[%s] %s", address, data);
    print(string);
    SendClientMessageToAll(COLOR_LINK, string);
    return 1;
}

public OnFilterScriptInit()
{
    socket_startlistening(PORT);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[160];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "%s says:%s", Name, text);
    socket_send(string);
    return 1;
}
As you can see I tested it in both ways, from my PC to my server and back, but nothing happends

It indeed looks like the OnSocketRecieve function doesnt gets called
Reply
#60

Plugin wont load on my Windows 0.3c Server (Windows XP Professional). I made sure i had the .NET Framework (4.0, 3.5, 2.0, 1.0) and it still isnt working. Any insight?

EDIT: Ignore. It would help if i added it to the server.cfg with the correct name huh?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)