27.08.2010, 05:38
(
Последний раз редактировалось StrickenKid; 25.01.2011 в 03:20.
Причина: Revision 2
)
SA:MP Sockets Plugin
Beta R2
Beta:Beta R2
This is a BETA version, which means its not fully complete and stable, so, please post any bugs and errors you find!
ChangeLog:
- 8/28/2010 - BETA R2:
- Fixed some small coding errors.
- Fixed error which caused the plugin to issue false errors with socket_send.
- Fixed receive error which was caused by the buffer being too large.
- Fixed spelling error with OnSocketReceive callback.
- Added socket_stoplistening to stop listening for connections.
- Added port param to OnSocketConnect callback.
- Added port param to OnSocketReceive callback.
A couple months ago, I was experimenting with socket compatibilities through a SA:MP plugin (because dgram through SA:MP doesn't work). I completed the plugin a while back but I've put off releasing it because I was never able to find the time to test the plugin thoroughly. So, I've just decided to let you, the SA:MP community help do the testing! This plugin allows a SA:MP server to connect to TCP sockets, sending and receiving information from one server to another, or from a server to a client. You can either listen for sockets, or connect to a socket. For example: You could connect multiple SA:MP server's chats together, or create a custom rcon panel, or pretty much anything else.
How To Install:
- Windows:
- Download the plugin.
- Place the sockets.dll in your plugins folder.
- Open your server.cfg and add "sockets" to "plugins", if there is no "plugins" line, add one.
- Add sockets.inc to your /pawno/includes/ and add "#include <sockets>" to the top of your script.
- Linux:
- Download the plugin to your linux server.
- Place the sockets.so in your plugins folder.
- Open your server.cfg and add "sockets.so" to "plugins", if there is no "plugins" line, add one.
- On the PC that you compile your script on, add sockets.inc to your /pawno/includes/ and add "#include <sockets>" to the top of your script.
- native socket_startlistening(port);
- Use this function to start listening for sockets on the selected port.
- native socket_stoplistening();
- Use this function to stop listening for sockets.
- native socket_connect(ip[], port);
- Use this function to connect to a socket server listening for connections.
- native socket_send(data[]);
- Use this function to send data to the connected socket.
- native socket_close();
- Use this function to close the connection of the current connected socket.
- forward OnSocketConnect(address[], port)
- This callback gets called when a socket is accepted to the listening server.
- forward OnSocketRecieve(data[], address[], port)
- This callback gets called when data has been received from the connected socket.
- Windows (.NET Framework required)
- Linux (compiled on Debian 5)
- Source
- Scripts
- Windows:
- Visual Studio 2008 Required
- Open the project file and click Build>Build Solution or press F7
- Linux:
- make, gcc and g++ required
- cd to the directory the plugin files are in and simply type "make"
Post Comments And Questions!