'////////////////////////////////////////////////////////////////////////
'// EXAMPLE SOCKET SCRIPT FOR 9.4
'// WRITTEN BY: Chriso
'// This script will create a socket called 'MySocket' and show you how
'// to use the events of that socket.
'////////////////////////////////////////////////////////////////////////

'// Declare MySocket Object
Dim MySocket

'// Return Script Information
Sub Script(Name, Major, Minor, Build, Author, Commands, Description)
	Name = "Example Socket Script"
	Major = 1
	Minor = 0
	Build = 0
	Author = "Chriso"
	Commands = ""
	Description = "Example of how to add a winsock using a script"
End Sub

'// Called when the script is loaded for a particular bot
Sub Event_Load()
	Set MySocket = AddSocket("MySocket", "ExampleSocket")
	MySocket.Close
	MySocket.Connect "63.241.83.13", "6112"
End Sub

'// Called when MySocket's connection is closed
Sub MySocket_Close()
	AddChat vbRed, "MySocket->Closed()"
End Sub

'// Called when MySocket has connected
Sub MySocket_Connect()
	AddChat vbYellow, "MySocket->Connected()"
End Sub

'// Called when an incoming connection request occurs
Sub MySocket_ConnectionRequest(RequestID)
	AddChat vbYellow, "MySocket->ConnectionRequest(" & RequestID & ")"
End Sub

'// Called when incoming data is being received
Sub MySocket_DataArrival(bytesTotal)
	AddChat vbYellow, "MySocket->DataArrival(" & bytesTotal & ")"
End Sub

'// Called when an error occurs
Sub MySocket_Error(Number, Description)
	AddChat vbRed, "MySocket->Error(" & Number & ", " & Description & ")"
End Sub

'// Called when sending is complete
Sub MySocket_SendComplete()
	AddChat vbYellow, "MySocket->SendComplete()"
End Sub

'// Called when sending is in progress
Sub MySocket_SendProgress(bytesSent, bytesRemaining)
	AddChat vbYellow, "MySocket->SendProgress(" & bytesSent & ", " & bytesRemaining & ")"
End Sub