Scripting/Squirrel/Functions/NewSocket/Example
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Client
An HTTP request example.
function HTTP()
{
Socket <- NewSocket( "dataReceived" );
Socket.SetNewConnFunc( "newConn" );
Socket.Connect( "www.example.com", 80 )
}
function dataReceived( data )
{
print( data );
}
function newConn()
{
local request = @"GET / HTTP/1.0
Host: www.example.com
";
Socket.Send( request );
}