This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[EXTENSION] Sockets (2.0.0)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Olly
Senior Member
Join Date: Mar 2007
Location: UK
Old 04-30-2007 , 16:27   [EXTENSION] Sockets (2.0.0)
Reply With Quote #1

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

Any bugs then get me in #sourcemod

Credits:
BAILOPAN, PimpinJuice, devicenull, and anyone else i missed from #sourcemod

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 Stringutput The output string
* @param size The length of the output buffer
*/
native md5HashString(String:in[], Stringut[], 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

Change Log
Quote:
1.0.0.0
  • Initial Release
1.0.0.1
  • Minor changes (never released)
1.0.1.0
  • Huge overhaull of everything in the plugin (consider this the first release)
1.0.2.0
  • Fixed lots of null pointer crashes ><
  • Fixed the native name in the include for SocketClose
  • Fixed functag
  • Compiled for linux
1.2.0.0
  • Skipped a load of version numbers (because i can)
  • Added SetConnectedCallback, and SetDisconnectCallback
  • CreateSocket now returns a Handle type which needs to be passed to all natives
  • Removed lots of the BS comments
  • Hopefully fixed lots of crashes in linux
  • Added arg argument for all callbacks to identify the socket that called back
2.0.0
  • Fixed lots of bugs
  • Fixed problem with the way i setup the callbacks (thanks bailo)
  • Changed the way that the natives work, less 'set callack' natives, so it works much better
  • The SocketReceive native now has the data that was got from the socket in one of the paramaters, instead of needing to specify a global string of a fixed size.
  • Compiled for Orange-Box
Attached Files
File Type: zip sockets_src.zip (1.11 MB, 554 views)
File Type: zip sockets_v2.0.zip (223.1 KB, 595 views)
File Type: zip sockets_v2.0-OrangeBox.zip (222.8 KB, 493 views)

Last edited by Olly; 02-13-2008 at 15:25. Reason: Because i can
Olly is offline
Send a message via MSN to Olly
 



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 16:57.


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