Raised This Month: $12 Target: $400
 3% 

[EXTENSION] Socket (3.0.1)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 02-28-2008 , 00:22   [EXTENSION] Socket (3.0.1)
Reply With Quote #1

latest version: http://forums.alliedmods.net/attachm...chmentid=83286

This extension provides networking functionality for SourceMod scripts. It's a heavily modified fork of Olly's sockets extension 2.0.0.

It's supposed to be stable. If it crashes please post the srcds debug.log and the plugin's sourcecode which makes use of the socket extension.

You need at least SourceMod 1.0.3!

Look at socket.inc for development documentation.


Developer Notes
  • Make sure to use all 3 Set...Callback functions on sockets spawned by listen sockets before using the child sockets.
  • Don't use ports below 1024 for listening sockets due to permission restrictions on linux
  • Do not expect SocketConnect() and SocketSend() to be atomic operations, both might not have finished yet after they were executed. Always use the socket connect-callback as shown in the example to start sending data.
  • Don't forget to close the socket handle

Usage example


The example example.sp downloads a file via http to <modfolder>/dl.htm
The example listenexample.sp provides a simple echo server. Use telnet <serverip> 50000 to connect to it.
The examples are located at addons/sourcemod/scripting in the socket.zip file.


Changelog

Version 2.4.0+
  • check the git(web) shortlog (see sourcecode repository url)
Version 2.3.1
  • fixed an error handling bug
Version 2.3.0
  • Added SocketDisconnect()
  • fixed a crashbug on unload
  • fixed receiving binary data
  • improved error handling
  • stricter condition checking
  • fixed a possible race condition in SocketSetSendqueueEmptyCallback()
Version 2.2.0
  • Added optional SendqueueEmpty callback which allows an application to correctly close the connection after all data has been sent
  • Fixed SocketSend() calculating the packet size 1 byte too large if it was not specified explicitly (thx to olly for finding the bug)
Version 2.1.0
  • Added SocketSetOption()
  • Added optional packet/callback concatenation mechanism to reduze the amount of receive callbacks for large transfers
  • removed Metamod:Source dependency (-> AddGameFrameHook)
  • improved sending of large chunks of data
  • everything should be binary safe now (support for sending/receiving 0x00), read the documentation for details
  • moved sending and connecting into threads
  • a few bugfixes
Version 2.0.0
  • Added SocketBind() and SocketListen() -> listening socket support
  • major API change to unify and optimize the socket usage
  • some additional small changes
Version 1.0.0
  • initial public release

Sourcecode repository


http://player.to/gitweb/index.cgi?p=sm-ext-socket.git

- Clone my public repository:
git clone git://player.to/sm-ext-socket.git <directory>

Download

latest version:
http://forums.alliedmods.net/attachm...chmentid=83286
Attached Files
File Type: zip socket_3.0.1.zip (633.2 KB, 155858 views)

Last edited by sfPlayer; 03-06-2011 at 10:06. Reason: version 3.0.1
sfPlayer is offline
 


Thread Tools
Display Modes

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 17:21.


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