[EXTENSION] Sockets (2.0.0)
3 Attachment(s)
Hi,
I have made this extension so that your server can communicate with other servers, and send and receive data between them. This can be used for downloading through HTTP, creating an irc bot, querying another game server.. List goes on :P Any bugs then get me in #sourcemod :oops: Credits: BAILOPAN, PimpinJuice, devicenull, and anyone else i missed from #sourcemod :D Install: 1. Extract 'sockets.ext.dll' to the 'addons/sourcemod/extensions' folder. 2. Extract 'sockets.inc' to the 'addons/sourcemod/scripting/include' folder. WINDOWS ONLY AT THE MOMENT, LINUX WILL BE TOMOROW Changed Natives: /** * Creates a new socket. * * @param protocol The type of socket to create, TCP (default), or UDP * @param SocketRecieve:rfunc The recieve callback. * @param SocketError:efunc The error callback. * @return Handle The socket handle. Returns INVALID_HANDLE on failure */ native Handle:CreateSocket(SocketType:protocol=SOCKE T_TCP, SocketRecieve:rfunc, SocketError:efunc); This has now changed, the SocketRecive, and SocketError callbacks are now paramaters of this native. /** * Convert a string to an MD5 hash (used for irc-relay) * * @param String:input The input string * @param String:output The output string * @param size The length of the output buffer */ native md5HashString(String:in[], String:out[], size); This has nothing todo with sockets, but i needed in in IRC-Relay because SQLite sucks balls public(String:recieveData[], const dataSize, Handle:arg) The socketrevieve callback signature is now as above Plugin Example I couldnt be bothered to write a new example plugin. But you can check my new IRC Relay which i will be posting after this. Enjoy :up: Change Log Quote:
|
Re: [EXTENSION] Sockets
Great job :)
I will probably find some use for it soon. |
Re: [EXTENSION] Sockets
Nice, although I would like to see this implemented in a more SM-ish way. Using a Handle and then some callbacks for the different socket interactions like connect, disconnect, receive, maybe error, etc.
Edit: Also maybe use the same naming convention used in SourceMod, rather than all lowercase and underscores. |
Re: [EXTENSION] Sockets
Quote:
But I will be adding callbacks and handles soon :) |
Re: [EXTENSION] Sockets
No nix'? If you need help with nix build, ask me.
|
Re: [EXTENSION] Sockets
Ok I am doing a major reworking of this plugin.
* Callbacks * Seperate connect & open socket * Fixed naming (sslice :P) * Added bind * Gonna add some stuff i havnt written yet :) * And i have linux now, so i will be able to provide one when the time comes Lets just call the current extension a practice run :) |
Re: [EXTENSION] Sockets
Possibly add accept and listen as well? Might not want to give plugins the ability to serve connections though.
|
Re: [EXTENSION] Sockets
added to my todo list :)
A little note. This extension is going to change quite drasticly in the next version. So at the moment, pretend this extension isnt here |
Re: [EXTENSION] Sockets
These are the revised natives for Sockets Ext. There is no more recieve native, because receiving data is handled internally by the extension, but when data is received it will call the recieve callback so stuff can be done to the received data.
I still have some more functions to add, but cant think of them off hand right now, its like 3am :P Code:
// Error type codes |
Re: [EXTENSION] Sockets
Use handles!
I have some code that uses them, grab me on IRC. |
All times are GMT -4. The time now is 09:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.