    ' [S]imple [N]etwork [C]onnection
    #include once "snc.bi"
    #include once "snc_utility.bi"

    var typejpg = "jpg-baseline"
    var mapstyle = "feature:road%7Cvisibility:off&style=element:labels%7Cvisibility:off&style=element:geometry.stroke%7Cvisibility:off"

    ' !!! change it !!!
    var lat=57.6224599 ' white house from top :-) 
    var lng=39.8870074
    var zoom=18
    var scale=1
    var size=1024

    var path="/maps/api/staticmap?center=" & lat & "," & lng & _
             "&zoom="  & zoom & _
             "&scale=" & scale & _
             "&size="  & size & "x" & size & _
             "&maptype=satellite" & _
             "&format=" & typejpg & _
             "&style=" & mapstyle


    ' test of a client connection
    var ServerName = "maps.googleapis.com"
    var ServerPath = path
    var ServerFile = "test_" & lat & "_" & lng & ".jpg"

    ' connect to web server at port 80
    dim as NetworkClient client = type(ServerName,80)

    ' get a connection from ConnectionFactory
    var connection = client.GetConnection()

    ' build an HTTP GET request
    dim as string request = HTTPGet(ServerName,ServerPath,"")

    ' ready to send ?
    while connection->CanPut()<>1
      sleep 100
    wend
    ' put data on the connection
    connection->PutData(strptr(request),len(request))

    ' ready to receive ?
    while connection->CanGet()<>1
      sleep 100
    wend
    print "receive " & ServerFile
    dim as zstring ptr buffer
    var nBytes = connection->GetData(buffer)
    print "number of received bytes " & nBytes
    ' get last char position of the HTTP asci header
    var LastChar=instr(*buffer,HeaderEnd)-1
    var Header  =left(*buffer,LastChar)
    ' is it a OK answer ?
    if instr(Header,"200 OK")<1 then
      print "can't get " & ServerName & ServerPath & " !"
      beep:sleep:end
    end if
    ' get first byte behind the HTTP header
    var DataStart=LastChar+4
    ' save it
    open ServerFile for binary access write as #1
    dim as ubyte ptr FileBuffer=@buffer[DataStart]
    nBytes-=DataStart
    put #1,,*FileBuffer,nBytes
    close #1
    print "file saved ..."
    ' free the buffer (allocate by snc.bi)
    deallocate buffer
    sleep
