Scripting/Squirrel/Functions/NewSocket/Example

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
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 );
}

Server